parent
109ddd9ff5
commit
55d1d5372e
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class Autoload
|
||||
{
|
||||
private static $_instance = null;
|
||||
|
||||
public static function charger()
|
||||
{
|
||||
if(null !== self::$_instance) {
|
||||
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
|
||||
}
|
||||
|
||||
self::$_instance = new self();
|
||||
|
||||
|
||||
if(!spl_autoload_register(array(self::$_instance, '_autoload'))) {
|
||||
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
|
||||
}
|
||||
}
|
||||
|
||||
public static function shutDown()
|
||||
{
|
||||
if(null !== self::$_instance) {
|
||||
|
||||
if(!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
|
||||
throw new RuntimeException('Could not stop the autoload');
|
||||
}
|
||||
|
||||
self::$_instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function _autoload($class)
|
||||
{
|
||||
global $rep;
|
||||
$filename = $class.'.php';
|
||||
$dir =array('models/','./','config/','controllers/');
|
||||
foreach ($dir as $d){
|
||||
$file=$rep.$d.$filename;
|
||||
//echo $file;
|
||||
if (file_exists($file))
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
//gen
|
||||
//$rep = __DIR__ . '/../';
|
||||
|
||||
// liste des modules à inclure
|
||||
|
||||
//$dConfig['includes']= array('controleur/Validation.php');
|
||||
|
||||
//BD
|
||||
|
||||
$base = 'dbkemondejar';
|
||||
$login = '';
|
||||
$mdp = '';
|
||||
|
||||
//Vues
|
||||
|
||||
$vues['erreur'] = 'views/erreur.php';
|
||||
$vues['accueil'] = 'views/accueil.php';
|
||||
$vues['bandeau'] = 'views/HeaderView.php';
|
||||
$vues['citation']= 'views/CitationView.php';
|
||||
|
||||
$model['citation'] = 'models/CitationModel.php';
|
||||
|
||||
$style['accueil'] = 'public/styles/styleAccueil.css';
|
||||
|
||||
?>
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$rep = __DIR__ . '/';
|
||||
|
||||
//controller objet
|
||||
require(__DIR__.'/controllers/controleur.php');
|
||||
|
||||
//chargement config
|
||||
require_once(__DIR__.'/config/config.php');
|
||||
|
||||
//chargement autoloader pour autochargement des classes
|
||||
require_once(__DIR__.'/config/autoload.php');
|
||||
Autoload::charger();
|
||||
|
||||
$_REQUEST['action'] = 'accueil';
|
||||
$cont = new Controleur();
|
||||
|
||||
|
||||
?>
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
require_once('../../controllers/CitationController.php');
|
||||
|
||||
$controller = new CitationController();
|
||||
$controller->index();
|
||||
?>
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
require (__DIR__.'/HeaderView.php');
|
||||
//require ($rep.$vues['bandeau']);
|
||||
//require ($rep.$vues['citation']);
|
||||
?>
|
Loading…
Reference in new issue