Intégration de l'autoloader

This commit is contained in:
xdrm-brackets 2015-12-06 19:42:02 +01:00
parent 7a4c2e7f87
commit e079849835
10 changed files with 56 additions and 47 deletions

View File

@ -3,7 +3,6 @@
<?php <?php
require_once __ROOT__.'/manager/security.php'; require_once __ROOT__.'/manager/security.php';
require_once __ROOT__.'/manager/database.php';
/*********************************************************** /***********************************************************
* * * *

View File

@ -1,13 +1,13 @@
<?php require_once __ROOT__.'/manager/security.php'; <?php require_once __ROOT__.'/manager/security.php';
/* INCLUSION DES REPOs */ /* INCLUSION DES REPOs */
require_once __ROOT__.'/manager/repo/user.php'; // gestion des utilisateurs (UID, infos, création, modification) // require_once __ROOT__.'/manager/repo/user.php'; // gestion des utilisateurs (UID, infos, création, modification)
require_once __ROOT__.'/manager/repo/group.php'; // gestion des groupes & appartenances (UID, ajouter membres, visu membres, création, modification) // require_once __ROOT__.'/manager/repo/group.php'; // gestion des groupes & appartenances (UID, ajouter membres, visu membres, création, modification)
require_once __ROOT__.'/manager/repo/semestre.php'; // require_once __ROOT__.'/manager/repo/semestre.php';
require_once __ROOT__.'/manager/repo/module.php'; // require_once __ROOT__.'/manager/repo/module.php';
require_once __ROOT__.'/manager/repo/ue.php'; // require_once __ROOT__.'/manager/repo/ue.php';
require_once __ROOT__.'/manager/repo/controle.php'; // require_once __ROOT__.'/manager/repo/controle.php';
require_once __ROOT__.'/manager/repo/note.php'; // require_once __ROOT__.'/manager/repo/note.php';
// debug(); // debug();
class DBAccess{}; class DBAccess{};

View File

@ -1,6 +1,5 @@
<?php <?php
require_once __ROOT__.'/manager/security.php'; require_once __ROOT__.'/manager/security.php';
require_once __ROOT__.'/manager/database.php';
/*********************************************************** /***********************************************************
* * * *

View File

@ -1,6 +1,5 @@
<?php <?php
require_once __ROOT__.'/manager/security.php'; require_once __ROOT__.'/manager/security.php';
require_once __ROOT__.'/manager/database.php';
/*********************************************************** /***********************************************************
* * * *

View File

@ -1,6 +1,5 @@
<?php <?php
// require_once __ROOT__.'/manager/database.php';
// GESTION DES NOTIFICATIONS // GESTION DES NOTIFICATIONS

View File

@ -1,4 +1,4 @@
<?php <?php define('__ROOT__', dirname(dirname(__FILE__)) );
/*********************************************************** /***********************************************************
* * * *
@ -8,7 +8,7 @@
* * * *
* [0] Constantes * * [0] Constantes *
* [1] Session & redirection * * [1] Session & redirection *
* * * [2] autoloader *
* * * *
* * * *
* * * *
@ -158,39 +158,24 @@
} }
/*function checkParamBIS( ...$checkIt ) {
/* [2] AUTOLOADER
================================================================*/
function autoLoader($className) {
// checkIt[] Tableau | checkIT[][] Types des Variables | checkIt[][][] Formats des variables | checkIt[][][][] Valeur des varialbes // si on charge un Repo
if( preg_match('/^([a-z]+)Repo$/', $className, $match) ){
require_once __ROOT__.DIRECTORY_SEPARATOR.'manager'.DIRECTORY_SEPARATOR.'repo'.DIRECTORY_SEPARATOR.$match[1].'.php';
$checker = false;
for( $i = 0; $i < func_num_args(); $i++) {
for( $j = 0; $j < sizeof( $checkIt[$i] ); $j++) {
switch ($checkIt[$i][$j]) {
case 'string': if( is_string( $checkIt[$i][$j][$j][$j] ) )
$checker = is_string( $checkIt[$i][$j][$j][$j] ) && preg_match( $checkIt[$i][$j][$j], (String) $checkIt[$i][$j][$j][$j] );
break;
case 'int': if( is_string( $checkIt[$i][$j][$j][$j]) )
$checker = is_int( $checkIt[$i][$j][$j][$j] ) && preg_match( $checkIt[$i][$j][$j], (String) $checkIt[$i][$j][$j][$j] );
break;
case 'numeric': if( is_string( $checkIt[$i][$j][$j][$j]]) )
$checker = is_numeric( $checkIt[$i][$j][$j][$j] ) && preg_match( $checkIt[$i][$j][$j], (String) $checkIt[$i][$j][$j][$j] );
break;
case 'array': if( is_numeric( $checkIt[$i][$j][$j][$j]) )
$checker = is_array( $checkIt[$i][$j][$j][$j] ) && count( $checkIt[$i][$j][$j] ) > 0;
break;
} }
} // si c'est un manager
elseif( is_file(__ROOT__.DIRECTORY_SEPARATOR.'manager'.DIRECTORY_SEPARATOR.strtolower($className).'.php') )
require_once __ROOT__.DIRECTORY_SEPARATOR.'manager'.DIRECTORY_SEPARATOR.strtolower($className).'.php';
// sinon
// .....
} }
return $checker; spl_autoload_register('autoLoader', false, true);
}*/
?> ?>

View File

@ -1,6 +1,5 @@
<?php <?php
require_once __ROOT__.'/manager/security.php'; require_once __ROOT__.'/manager/security.php';
require_once __ROOT__.'/manager/database.php';
/*********************************************************** /***********************************************************
* * * *

View File

@ -1,5 +1,5 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) ); <?php define('__ROOT__', dirname(dirname(__FILE__)) );
require_once __ROOT__.'/manager/groups.php'; require_once __ROOT__.'/manager/security.php';
/**************************************** /****************************************
* * * *

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 KiB

View File

@ -45,13 +45,42 @@ require_once __ROOT__.'/manager/security.php';
debug(); debug();
var_dump( $_SESSION ); // var_dump( $_SESSION );
// require_once __ROOT__.'/manager/database.php';
// $moyenneUEetu = DataBase::getPDO()->query("SELECT * FROM utilisateur");
// var_dump( $moyenneUEetu->fetchAll() );
var_dump( DataBase::getInstance()->listeUtilisateursRole(2015) );
/*************************/
/* CONCEPTION DE PASSAGE */
/*************************/
// $_SESSION['annee'] = 2015; // $_SESSION['annee'] = 2015;
// require_once __ROOT__.'/manager/phpExcel.php';
// require_once __ROOT__.'/manager/groups.php'; // require_once __ROOT__.'/manager/groups.php';
// $_SESSION['identifiant'] = 'modele'; // afin de lire le fichier // $_SESSION['identifiant'] = 'modele'; // afin de lire le fichier