51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
|
<?php
|
||
|
class AccueilModules {
|
||
|
private $persistance = 'db/config.xml';
|
||
|
private $modules = array();
|
||
|
|
||
|
|
||
|
function __construct(){
|
||
|
if($config = simplexml_load_file($this->persistance)){
|
||
|
$config_xml = $config->item;
|
||
|
foreach($config_xml as $item){
|
||
|
$this->modules["$item[id]"] = $item;
|
||
|
}
|
||
|
$this->getModules();
|
||
|
$this->buildConfigMenu();
|
||
|
}else{
|
||
|
echo 'baaaaad persistance...';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function getModules(){
|
||
|
foreach($this->modules as $module=>$moduleConf){
|
||
|
if(file_exists('class/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
|
||
|
$params = array();
|
||
|
foreach($moduleConf as $confParam){
|
||
|
$params[$confParam->getName()] = "$confParam";
|
||
|
}
|
||
|
require ucfirst($module).'.php';
|
||
|
call_user_func(array($module, "start"), $params);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function buildConfigMenu(){
|
||
|
echo '<a href="#config" id="config-menu">Configuration</a>
|
||
|
<div style="display:none;">
|
||
|
<div id="config">
|
||
|
<form id="config_form" action="" method="post">
|
||
|
<h3>Modules configuration</h3><br/>';
|
||
|
foreach($this->modules as $module=>$moduleConf){
|
||
|
echo $module.' module : <input type="radio" name="'.$module.'_group" value="true"';
|
||
|
if ($moduleConf->visibility == "true") echo " checked";
|
||
|
echo '/>true <input type="radio" name="'.$module.'_group" value="false"';
|
||
|
if ($moduleConf->visibility == "false") echo " checked";
|
||
|
echo '/>false<br/><br/>';
|
||
|
}
|
||
|
echo '<a id="config-submit" href="" class="green-button">Enregistrer</a>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>';
|
||
|
}
|
||
|
}
|