autoloader qui marche ouipi

main
thchazot1 2 years ago
parent d89303c348
commit d7477bf8a9

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Ajouter une Liste</title>
<link rel="stylesheet" href="Style/bootstrap.css">
</head>
<?php
$dataView[]=new Liste(12, "test", false, null, array());
$dataView[]=new Liste(12, "belle bite", false, null, array());
if (isset($dataView)):
foreach ($dataView as $list){
?>
<div class="container">
<div class="row">
<div class="col">
<?php echo $list->getName(); ?>
</div>
<button class="col">
Modifer la liste
</button>
</div>
</div>
<?php
}
endif;
?>

@ -20,10 +20,10 @@ class Autoload{
private static function _autoload($class){ private static function _autoload($class){
global $rep; global $rep;
$filename = $class.'.php'; $filename = $class.'.php';
$dir = array('modeles/', 'config', 'controllers'); $dir = array('modeles/', 'config/', 'controllers/', 'metier/');
foreach ($dir as $d){ foreach ($dir as $d){
$file=$rep.$d.$filename; $file=$rep.$d.$filename;
if($file_exists($file)){ if(file_exists($file)){
include $file; include $file;
} }
} }

@ -4,10 +4,10 @@ $rep = __DIR__ . '/../';
//$location = "Location : http://londres.uca.local/" Finir le chemin du public_html //$location = "Location : http://londres.uca.local/" Finir le chemin du public_html
$base=""; //nom bdd $base="dbthchazot1"; //nom bdd
$login=""; $login="thchazot1";
$password=""; $password="achanger";
$dsn=""; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut) $dsn="mysql:host=localhost;dbname=dbthchazot1"; // chemin vers bd (mysql:host=londres.uca.local;dbname=dblibreton => pour l'iut)
$vues['erreur'] = 'Vues/erreur.php'; $vues['erreur'] = 'Vues/erreur.php';

@ -1,7 +1,5 @@
<?php <?php
require_once('./metier/liste.php');
class ListeGateway class ListeGateway
{ {

@ -1,7 +1,5 @@
<?php <?php
require_once('./metier/tache.php');
class TacheGateway class TacheGateway
{ {

@ -1,6 +1,5 @@
<?php <?php
require_once('./metier/user.php');
class UserGateway class UserGateway
{ {

@ -4,31 +4,11 @@
<?php <?php
require_once("gateway/connection.php"); require_once('config/Autoload.php');
require_once('gateway/tacheGateway.php'); Autoload::charger();
require_once('gateway/userGateway.php');
require_once("gateway/listeGateway.php");
require_once('metier/user.php');
require_once('metier/liste.php');
require_once('metier/tache.php');
require_once('modeles/mdlUser.php');
require_once('modeles/mdlListe.php');
//A CHANGER
$user= 'thchazot1';
$pass='achanger';
$dsn='mysql:host=localhost;dbname=dbthchazot1';
$id=1;
$name='Argent';
$content='Argent, Encore de l\'argent';
try{ try{
require("Vues/accueil.php");
require("Vues/signUp.php");
} }
catch( PDOException $Exception ) { catch( PDOException $Exception ) {
echo 'erreur'; echo 'erreur';

@ -1,8 +1,5 @@
<?php <?php
require_once('user.php');
require_once('tache.php');
class Liste class Liste
{ {

@ -1,6 +1,5 @@
<?php <?php
require_once('user.php');
class Tache class Tache
{ {

@ -5,6 +5,7 @@ class User
private $id; private $id;
private $username; private $username;
private $password; private $password;
function __construct( int $id, string $username, string $password) function __construct( int $id, string $username, string $password)
{ {
$this->id=$id; $this->id=$id;
Loading…
Cancel
Save