fin réorganisation

pull/17/head
kevin.modejar 6 months ago
parent 0836c9c616
commit 7f288e6699

@ -0,0 +1,13 @@
{
"require": {
"twig/twig": "^3.0"
},
"autoload": {
"psr-4": {
"Controleu\\": "src/Controleur/",
"config\\": "config/",
"Model\\": "src/Model/",
"Entity\\": "src/Entity/"
}
}
}

@ -1,51 +0,0 @@
<?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;
}
}
}
}
?>

@ -13,15 +13,33 @@ $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';
//Entitées
$entity['user'] = 'src/Entity/userEntity';
$entity['quote'] = 'src/Entity/quoteEntity';
$entity['question'] = 'src/Entity/questionEntity';
//Model
$model['user'] = 'src/Model/userModel.php';
$model['quote'] = 'src/Model/quoteModel.php';
//Gateway
$gateway['user'] = 'src/Gateway/userGateway';
$gateway['quote'] = 'src/Gateway/quoteGateway';
$model['citation'] = 'models/CitationModel.php';
//Controleur
//Vues
$vues['erreur'] = 'vue/erreur.php';
//Style css
$style['accueil'] = 'public/styles/styleAccueil.css';
//Script js
//Images
$image['default'] = 'public/images/default.jpg';
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

@ -0,0 +1,3 @@
<svg width="138" height="130" viewBox="0 0 138 130" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M69 11.3884C107.279 -28.1488 202.984 41.037 69 130C-64.9844 41.0456 30.7212 -28.1488 69 11.3884Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 269 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 262.86">
<path fill-rule="nonzero" d="M316.78 16.55h-205.9c-30.5 0-58.22 12.48-78.31 32.57C12.47 69.21 0 96.93 0 127.44c0 30.5 12.47 58.22 32.57 78.31 20.09 20.1 47.81 32.57 78.31 32.57h193.25c21.54 15.43 47.9 24.54 76.26 24.54h.18c36.14 0 69.02-14.79 92.83-38.6 23.8-23.81 38.6-56.67 38.6-92.83 0-36.15-14.78-69.03-38.63-92.8C449.53 14.8 416.67 0 380.57 0h-.18c-23.02 0-44.72 6.02-63.61 16.55zm70.62 97.17.43.09c.82-3.45 2.83-6.19 6.04-8.16 3.2-1.98 6.53-2.57 10.01-1.75l.1-.43c-3.47-.82-6.2-2.83-8.17-6.03-1.98-3.22-2.57-6.55-1.75-10.01l-.43-.1c-.82 3.47-2.83 6.2-6.03 8.18-3.21 1.98-6.55 2.56-10.02 1.74l-.1.43c3.47.82 6.2 2.84 8.18 6.04 1.99 3.19 2.56 6.52 1.74 10zm36.87 16.77.53.12c1.02-4.35 3.55-7.78 7.58-10.26 4.02-2.49 8.2-3.22 12.56-2.19l.13-.53c-4.35-1.03-7.78-3.55-10.26-7.59-2.49-4.03-3.22-8.22-2.2-12.56l-.53-.12c-1.02 4.35-3.55 7.77-7.58 10.26-4.02 2.49-8.21 3.22-12.56 2.19l-.13.53c4.36 1.03 7.78 3.55 10.26 7.58 2.49 4.02 3.22 8.22 2.2 12.57zm-38.79-61.01c-15.69 7.67-26.98 23.26-28.29 41.93-1.96 27.88 19.05 52.06 46.92 54.02 13.23.93 25.64-3.32 35.22-11.02 4.75-3.82 9.66-.45 7.59 4.36-11.33 26.42-38.45 44.04-68.74 41.91-38.29-2.69-67.14-35.91-64.45-74.19C316.3 89.8 347.05 61.67 383.44 62c6.71.06 8.13 4.5 2.04 7.48zm-5.09-53.95h.18c63.75 0 115.91 52.15 115.91 115.9 0 63.75-52.23 115.91-115.91 115.91h-.18c-63.68 0-115.91-52.16-115.91-115.91s52.16-115.9 115.91-115.9z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@ -0,0 +1,10 @@
<svg width="72" height="37" viewBox="0 0 72 37" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_103_508)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.0028 0H18.0281C21.1261 0 24.0511 0.817919 26.6062 2.25434H56.1909C60.5348 2.25434 64.4878 4.08237 67.3538 7.0289C70.2211 9.96965 72 14.0318 72 18.5C72 22.9682 70.2197 27.0303 67.3566 29.974L67.2975 30.0289C64.4372 32.9408 60.5067 34.7457 56.1909 34.7457H26.6119C24.0567 36.1806 21.1303 37 18.0281 37H18.0028C13.0528 37 8.55 34.9176 5.2875 31.5665C2.02641 28.2153 0 23.5896 0 18.5C0 13.4104 2.025 8.78324 5.28609 5.43208L5.41406 5.31214C8.66953 2.03035 13.1189 0 18.0028 0ZM17.1661 7.86416C17.1661 7.58237 17.2786 7.32514 17.4586 7.14162C17.8439 6.74133 18.4809 6.74277 18.8677 7.14017L18.8873 7.16329C19.0624 7.35234 19.16 7.60324 19.1602 7.86416V9.73555C19.1602 10.0173 19.0477 10.2746 18.8677 10.4595C18.4809 10.8569 17.8453 10.8569 17.4586 10.4595C17.3659 10.3645 17.2924 10.2517 17.2422 10.1275C17.192 10.0032 17.1662 9.87006 17.1661 9.73555V7.86416ZM18.0169 12.3685C19.665 12.3685 21.1556 13.0549 22.2356 14.1647C23.3142 15.2746 23.9836 16.8078 23.9836 18.5C23.9836 20.1936 23.3156 21.7254 22.2356 22.8353C21.1556 23.9451 19.665 24.6315 18.0169 24.6315C16.3687 24.6315 14.8781 23.9451 13.7967 22.8353C12.7181 21.7254 12.0487 20.1936 12.0487 18.5C12.0487 16.8064 12.7181 15.2746 13.7967 14.1647C14.8781 13.0564 16.3702 12.3685 18.0169 12.3685ZM10.0955 11.5968C9.90926 11.4044 9.80462 11.1442 9.80437 10.8728C9.80437 10.3092 10.2516 9.84827 10.8014 9.84827C11.0559 9.84827 11.3105 9.94798 11.5045 10.1474L12.7927 11.4711C12.8854 11.566 12.959 11.6788 13.0092 11.8031C13.0594 11.9273 13.0852 12.0606 13.0852 12.1951C13.0852 12.4552 12.9867 12.7182 12.7927 12.9191C12.7003 13.0145 12.5905 13.0901 12.4696 13.1417C12.3487 13.1933 12.219 13.2198 12.0881 13.2197C11.835 13.2197 11.5805 13.1185 11.385 12.9205L10.0955 11.5968ZM7.66547 19.3728C7.39125 19.3728 7.14094 19.2572 6.96234 19.0723C6.57281 18.6763 6.57422 18.0217 6.96094 17.6257L6.98203 17.6055C7.16633 17.4253 7.41107 17.3249 7.66547 17.3251H9.48516C9.61613 17.325 9.74585 17.3514 9.86688 17.4028C9.98791 17.4543 10.0979 17.5297 10.1905 17.6249C10.2831 17.7201 10.3565 17.8331 10.4066 17.9574C10.4566 18.0818 10.4823 18.2151 10.4822 18.3497C10.4822 18.6315 10.3697 18.8887 10.1911 19.0737C10.0037 19.2656 9.74975 19.3732 9.48516 19.3728H7.66547ZM11.2964 26.6387C11.2042 26.7337 11.0946 26.8091 10.9739 26.8604C10.8532 26.9117 10.7239 26.9381 10.5933 26.9379C10.0434 26.9379 9.59625 26.4812 9.59625 25.9147C9.59625 25.6532 9.69187 25.3916 9.88734 25.1908L11.1966 23.8483C11.3807 23.6678 11.6255 23.5674 11.88 23.5679C12.1444 23.5679 12.398 23.6759 12.585 23.868C12.772 24.0601 12.877 24.3208 12.877 24.5925C12.877 24.8512 12.78 25.1127 12.5845 25.3136L11.2964 26.6387ZM18.8648 29.1373C18.8648 29.4176 18.7523 29.6763 18.5723 29.8598C18.187 30.2587 17.55 30.2572 17.1633 29.8598L17.145 29.8381C16.9699 29.6492 16.8722 29.3982 16.8722 29.1373V27.2659C16.8722 26.9827 16.9847 26.7269 17.1633 26.5419C17.5514 26.1445 18.1856 26.1445 18.5737 26.5419C18.7601 26.7342 18.8648 26.9945 18.8648 27.2659V29.1373ZM25.9355 25.4046C26.028 25.4996 26.1014 25.6125 26.1514 25.7367C26.2013 25.861 26.2269 25.9942 26.2266 26.1286C26.2266 26.6907 25.7794 27.1532 25.2309 27.1532C24.9764 27.1532 24.7205 27.0535 24.5264 26.854L23.2383 25.5303C23.0515 25.3378 22.9468 25.0768 22.9472 24.8049C22.9472 24.2413 23.3944 23.7803 23.9428 23.7803C24.1959 23.7803 24.4505 23.8815 24.6459 24.0809L25.9355 25.4046ZM28.3669 17.6272C28.6383 17.6272 28.8914 17.7442 29.07 17.9277C29.4581 18.3251 29.4567 18.9783 29.07 19.3757L29.0489 19.396C28.8645 19.5751 28.6206 19.6753 28.3669 19.6763H26.5458C26.2702 19.6763 26.0198 19.5607 25.8412 19.3757C25.4531 18.9783 25.4531 18.3251 25.8412 17.9277C25.9335 17.8323 26.0433 17.7566 26.1643 17.705C26.2852 17.6534 26.4149 17.627 26.5458 17.6272H28.3669ZM24.7345 10.3613C24.9211 10.1697 25.174 10.0621 25.4377 10.0621C25.9861 10.0621 26.4361 10.5231 26.4361 11.0867C26.4361 11.3483 26.3391 11.6098 26.145 11.8092L24.8344 13.1546C24.6492 13.3333 24.4049 13.433 24.1509 13.4335C23.6011 13.4335 23.1539 12.974 23.1539 12.409C23.1539 12.1488 23.2523 11.8873 23.4464 11.6864L24.7345 10.3613ZM29.5397 4.31069C29.9559 4.66763 30.3567 5.04335 30.7392 5.43786C34.0045 8.78324 36.0309 13.4104 36.0309 18.5C36.0309 23.5896 34.0031 28.2153 30.7434 31.5665C30.3613 31.9587 29.9625 32.3333 29.5481 32.6893H56.1909C59.9639 32.6893 63.3966 31.1127 65.8969 28.5708L65.9419 28.5202C68.4436 25.9494 69.9989 22.4003 69.9989 18.5C69.9989 14.5997 68.4436 11.0506 65.9419 8.47832C63.443 5.90607 59.9892 4.31069 56.1909 4.31069H29.5397ZM18.0028 2.18497H18.0281C26.7595 2.18497 33.9033 9.52746 33.9033 18.5C33.9033 27.474 26.7511 34.815 18.0281 34.815H18.0028C9.27984 34.815 2.12625 27.474 2.12625 18.5C2.12625 9.52746 9.27141 2.18497 18.0028 2.18497Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_103_508">
<rect width="72" height="37" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 46.574219 3.425781 C 45.625 2.476563 44.378906 2 43.132813 2 C 41.886719 2 40.640625 2.476563 39.691406 3.425781 C 39.691406 3.425781 39.621094 3.492188 39.53125 3.585938 C 39.523438 3.59375 39.511719 3.597656 39.503906 3.605469 L 4.300781 38.804688 C 4.179688 38.929688 4.089844 39.082031 4.042969 39.253906 L 2.035156 46.742188 C 1.941406 47.085938 2.039063 47.453125 2.292969 47.707031 C 2.484375 47.898438 2.738281 48 3 48 C 3.085938 48 3.171875 47.988281 3.257813 47.964844 L 10.746094 45.957031 C 10.917969 45.910156 11.070313 45.820313 11.195313 45.695313 L 46.394531 10.5 C 46.40625 10.488281 46.410156 10.472656 46.417969 10.460938 C 46.507813 10.371094 46.570313 10.308594 46.570313 10.308594 C 48.476563 8.40625 48.476563 5.324219 46.574219 3.425781 Z M 45.160156 4.839844 C 46.277344 5.957031 46.277344 7.777344 45.160156 8.894531 C 44.828125 9.222656 44.546875 9.507813 44.304688 9.75 L 40.25 5.695313 C 40.710938 5.234375 41.105469 4.839844 41.105469 4.839844 C 41.644531 4.296875 42.367188 4 43.132813 4 C 43.898438 4 44.617188 4.300781 45.160156 4.839844 Z M 5.605469 41.152344 L 8.847656 44.394531 L 4.414063 45.585938 Z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -0,0 +1,3 @@
<svg width="165" height="263" viewBox="0 0 165 263" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M107.959 174.467C98.9557 168.667 96.0352 168.667 71.2207 174.467C73.0133 161.115 71.2207 146.011 71.2207 136.444C71.2207 123.354 76.6992 117.829 84.4336 109.236C92.168 100.643 96.0352 91.7282 96.0352 82.4909C96.0352 75.8315 94.209 69.8166 90.5566 64.446C86.9043 59.0755 80.459 56.3903 71.2207 56.3903C63.7012 56.3903 56.2891 59.0755 48.9844 64.446C41.8945 69.8166 35.9863 79.8057 31.2598 94.4135C20.7324 93.3394 12.8906 89.4726 7.73437 82.8132C2.57812 76.1538 0 68.5276 0 59.9348C0 50.6976 2.79297 41.4603 8.37891 32.223C14.1797 22.9858 22.8809 15.3596 34.4824 9.34467C46.2988 3.11489 61.0156 0 78.6328 0C99.6875 0 116.445 3.54453 128.906 10.6336C141.582 17.7227 150.713 26.8525 156.299 38.0232C162.1 49.1938 165 60.7941 165 72.824C165 86.3577 162.852 98.8173 158.555 110.203C154.473 121.373 148.779 131.04 141.475 139.203C134.385 147.367 126.436 153.704 117.627 158.215C108.818 162.726 113.135 170.621 107.959 174.467ZM80.0622 263C70.1794 263 61.9079 259.778 55.2477 253.333C48.8024 246.674 45.5798 238.618 45.5798 229.166C45.5798 221.862 47.4059 215.203 51.0583 209.188C54.7106 202.958 59.5446 197.91 65.5602 194.043C71.7907 190.176 78.6657 188.243 86.1852 188.243C96.0681 188.243 104.232 191.572 110.677 198.232C117.338 204.676 120.668 212.625 120.668 222.077C120.668 229.166 118.841 235.825 115.189 242.055C111.537 248.285 106.595 253.333 100.365 257.2C94.3493 261.067 87.5817 263 80.0622 263Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -0,0 +1,16 @@
<?php
//chargement config
require_once __DIR__ . '/../config/config.php';
require __DIR__ . '/vendor/autoload.php';
//twig
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader, [
'cache' => 'cache',
]);
$cont = new FrontControleur();
?>

Binary file not shown.

@ -1,27 +0,0 @@
<?php
#session_start();
#require_once('../bd/connexionDB.php');
#
#if(isset($_GET['user'])){
#$user = (String) trim($_GET['user']);
#
#$req = $DB->query("SELECT *
# FROM utilisateur
# WHERE nom LIKE ?
# LIMIT 10",
# array("$user%"));
#
#$req = $req->fetchALL();
$req=query(array('nom'=>'nom1','prenom'=>'prenom1'),array('nom'=>'nom2','prenom'=>'prenom2'),array('nom'=>'nom3','prenom'=>'prenom3'));
$req = $req->fetchALL();
foreach($req as $r){
?>
<div style="margin-top: 20px 0; border-bottom: 2px solid #ccc"><?= $r['nom'] . " " . $r['prenom'] ?></div><?php
}
#}
?>

@ -0,0 +1,32 @@
<?php
namespace controleur;
Class FrontControleur{
public function __construct(){
global $twig;
session_start();
$dVueEreur = [];
$router = new AltoRouter();
$router->map('GET', '/', 'FrontController');
$router->map('GET', '/user/quote/[p1:param1]?', 'UserController');
$match = $routeur->match();
if(!$match){
$dVueEreur[] = "Requette introuvable";
$this->vueErreur($dVueEreur);
}
else{
}
}
private function vueErreur(array $dVueErreur){
}
}

@ -0,0 +1,46 @@
<?php
class CharacterEntity
{
private int $id_character;
private string $name;
private string $img_path;
public function __construct(int $id_character, string $name, string $img_path)
{
$this -> id_character = $id_character;
$this -> name = $name;
$this -> img_path = $img_path;
}
public function getIdCharacter() : int
{
return $this -> id_character;
}
public function getName() : string
{
return $this -> name;
}
public function getImgPath() : string
{
return $this -> img_path;
}
public function setIdCharacter(int $id_character) : void
{
$this -> id_character = $id_character;
}
public function setName(string $name) : void
{
$this -> name = $name;
}
public function setImgPath(string $img_path) : void
{
$this -> img_path = $img_path;
}
}

@ -0,0 +1,39 @@
<?php
class CommentaryEntity {
private int $id_comment;
private string $comment;
private string $date;
public function __construct(int $id_comment, string $comment, string $date) {
$this->id_comment = $id_comment;
$this->comment = $comment;
$this->date = $date;
}
public function getIdComment(): int {
return $this->id_comment;
}
public function getComment(): string {
return $this->comment;
}
public function getDate(): string {
return $this->date;
}
public function setIdComment(int $id_comment): void {
$this->id_comment = $id_comment;
}
public function setComment(string $comment): void {
$this->comment = $comment;
}
public function setDate(string $date): void {
$this->date = $date;
}
}

@ -0,0 +1,88 @@
<?php
class QuestionEntity
{
private int $id_question;
private string $question;
private string $answerA;
private string $answerB;
private string $answerC;
private string $answerD;
private string $cAnswer;
public function __construct(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer)
{
$this -> id_question = $id_question;
$this -> question = $question;
$this -> answerA = $answerA;
$this -> answerB = $answerB;
$this -> answerC = $answerC;
$this -> answerD = $answerD;
$this -> cAnswer = $cAnswer;
}
public function getIdQuestion() : int
{
return $this -> id_question;
}
public function getQuestion() : string
{
return $this -> question;
}
public function getAnswerA() : string
{
return $this -> answerA;
}
public function getAnswerB() : string
{
return $this -> answerB;
}
public function getAnswerC() : string
{
return $this -> answerC;
}
public function getAnswerD() : string
{
return $this -> answerD;
}
public function getCAnswer() : string
{
return $this -> cAnswer;
}
public function setQuestion(string $newQuestion) : void
{
$this -> question = $question;
}
public function setAnswerA(string $newAnswerA) : void
{
$this -> answerA = $newAnswerA;
}
public function setAnswerB(string $newAnswerB) : void
{
$this -> answerB = $newAnswerB;
}
public function setAnswerC(string $newAnswerC) : void
{
$this -> answerC = $newAnswerC;
}
public function setAnswerD(string $newAnswerD) : void
{
$this -> answerD = $newAnswerD;
}
public function setCAnswer(string $newCAnswer) : void
{
$this -> cAnswer = $newCAnswer;
}
}

@ -0,0 +1,89 @@
<?php
class Quote{
private int $id;
private string $content;
private string $carac;
private string $imgPath;
private string $titleSrc;
private string $dateSrc;
private int $like;
private string $langue;
function __construct(int $id, string $content, string $carac, string $imgPath, string $titleSrc, string $dateSrc, int $like, string $langue) {
$this->id = $id;
$this->content = $content;
$this->carac = $carac;
$this->imgPath = $imgPath;
$this->titleSrc = $titleSrc;
$this->dateSrc = $dateSrc;
$this->like = $like;
$this->langue = $langue;
}
public function getId() : int{
return $id;
}
public function getContent() : string{
return $content;
}
public function getCarac() : string{
return $content;
}
public function getImgPath() : string{
return $imgPath;
}
public function getTitleSrc() : string{
return $titleSrc;
}
public function getDateSrc() : string{
return $dateSrc;
}
public function getLike() : int{
return $like;
}
public function getLangue() : string{
return $langue;
}
public function setId(int $id){
$this->id = $id;
}
public function setContent(string $content){
$this->content = $content;
}
public function setCarac(string $carac){
$this->carac = $carac;
}
public function setImgPath(string $imgPat){
$this->imgPath = $imgPath;
}
public function setTitleSrc(string $titleSrc){
$this->titleSrc = $titleSrc;
}
public function setDateSrc(string $dateSrc){
$this->datesrc = $dateSrc;
}
public function setLike(int $like){
$this->like = $like;
}
public function setlangue(string $langue){
$this->langue = $langue;
}
}
?>

@ -0,0 +1,47 @@
<?php
class SourceEntity
{
private int $id_source;
private string $title;
private string $date;
public function __construct(int $id_source, string $title, string $date)
{
$this -> id_source = $id_source ;
$this -> title = $title ;
$this -> date = $date;
}
public function getIdSource() : int
{
return $this -> id_source ;
}
public function getTitle() : string
{
return $this -> title ;
}
public function getDate() : string
{
return $this -> date ;
}
public function setIdSource(int $id_source) : void
{
$this -> id_source = $id_source ;
}
public function setTitle(string $title): void{
$this -> title = $title ;
}
public function setDate(string $date) : void
{
$this -> date = $date ;
}
}

@ -0,0 +1,64 @@
<?php
class User{
private string $id;
private string $username;
private string $passwd;
private string $hidenPasswd;
private string $img;
private string $email;
function __construct(string $id, string $pseudo, string $password, string $image, string $mail) {
$this->id = $id;
$this->username = $pseudo;
$this->passwd = $password;
$this->hidenPasswd = hidenPassWd($password);
$this->img = $image;
$this->email = $mail;
}
public function getId() : string{
return $this->id;
}
public function getUsername() : string{
return $this->username;
}
public function getPasswd() : string{
return $this->passwd;
}
public function getImg() : string{
return $this->img;
}
public function getEmail() : string{
return $this->email;
}
public function setUsername(string $username){
$this->username = $username;
}
public function setPasswd(string $passwd){
$this->passwd = $passwd;
$this->hidenPassWd = hidenPassWd($passwd);
}
public function setImg(string $img){
$this->img = $img;
}
public function setEmail(string $email){
$this->email = $email;
}
}
function hidenPassWd(string $passwd){
if(strlen($passwd) >= 16) return str_repeat('*', 16);
return str_repeat('*', strlen($passwd));
}
?>

@ -0,0 +1,31 @@
<?php
class Connection extends PDO {
private $stmt;
public function __construct(string $dsn, string $username, string $password) {
parent::__construct($dsn,$username,$password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/** * @param string $query
* @param array $parameters *
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []) : bool{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
public function getResults() : array {
return $this->stmt->fetchall();
}
}
?>

@ -0,0 +1,105 @@
<?php
require_once "../public/script/Connection.php";
require_once "characterEntity.php";
class CharacterGateway
{
private Connection $co;
public function __construct(Connection $co)
{
$this -> co = $co;
}
public function create(characterEntity $c) : bool
{
$query = "
INSERT INTO Character
VALUES(:id_character, :name, :img_path)
";
return $this -> co -> executeQuery($query, [
"id_character" => array($c -> getIdCharacter(), PDO::PARAM_INT),
"name" => array($c -> getName(), PDO::PARAM_STR),
"img_path" => array($c -> getImgPath(), PDO::PARAM_STR)
]);
}
public function findById(int $id) : ?characterEntity
{
$query = "SELECT * FROM Character WHERE id_character = :id_c";
$this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]);
$res = $this ->co -> getResults();
if($res)
return new characterEntity(
$res["id_character"],
$res["name"],
$res["img_path"]
);
return null;
}
public function findByName(string $name) : ?characterEntity
{
$query = "SELECT * FROM Character WHERE name = :n";
$this -> co -> executeQuery($query, ["n" => array($name, PDO::PARAM_STR)]);
$res = $this ->co -> getResults();
if($res)
return new characterEntity(
$res["id_character"],
$res["name"],
$res["img_path"]
);
return null;
}
public function findAll() : array
{
$query = "SELECT * FROM Character";
$this -> co -> executeQuery($query);
$res = $this ->co -> getResults();
$characters = [];
foreach ($res as $character)
{
$characters[] = new characterEntity(
$character["id_character"],
$character["name"],
$character["img_path"]
);
}
return $characters;
}
public function delete(int $id) : bool
{
$query = "DELETE FROM Character WHERE id_character = :id_c";
return $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]);
}
public function update(characterEntity $c) : bool
{
$query = "
UPDATE Character
SET name = :n, img_path = :i
WHERE id_character = :id_c
";
return $this -> co -> executeQuery($query, [
"id_c" => array($c -> getIdCharacter(), PDO::PARAM_INT),
"name" => array($c -> getName(), PDO::PARAM_STR),
"i" => array($c -> getImgPath(), PDO::PARAM_STR)
]);
}
}

@ -0,0 +1,68 @@
<?php
require_once "../public/script/Connection.php";
require_once "commentaryEntity.php";
class CommentaryGateway {
private Connection $co ;
public function __construct(Connection $co) {
$this->co = $co;
}
public function create(commentaryEntity $c) :bool {
$query="INSERT INTO Commentary VALUES(:id_comment, :comment , :date)";
return $this -> co -> executeQuery($query, array(
"id_comment" => array($c->getIdComment(), PDO::PARAM_INT),
"comment" => array($c->getComment(), PDO::PARAM_STR),
"date" => array($c->getDate(), PDO::PARAM_STR)));
}
public function findById(int $id) : ?commentaryEntity {
$query="SELECT * FROM Commentary WHERE id_comment = :id_comment";
$this -> co -> executeQuery($query, array("id_comment" => $id));
$res = $this -> co -> getResults();
if($res)
return new commentaryEntity($res["id_comment"], $res["comment"], $res["date"]);
return null;
}
public function findAll() : array {
$query="SELECT * FROM Commentary";
$this -> co -> executeQuery($query);
$res = $this -> co -> getResults();
$comments = [];
foreach ($res as $comment) {
$comments[] = new commentaryEntity(
$comment["id_comment"],
$comment["comment"],
$comment["date"]
);
}
return $comments;
}
public function delete(int $id) : bool {
$query="DELETE FROM Commentary WHERE id_comment = :id_comment";
return $this -> co -> executeQuery($query, array("id_comment" => $id));
}
public function update(commentaryEntity $c) : bool {
$query="UPDATE Commentary SET comment = :comment WHERE id_comment = :id_comment";
return $this -> co -> executeQuery($query, array(
"comment" => array($c->getComment(),PDO::PARAM_STR),
"id_comment" => array($c->getIdComment(),PDO::PARAM_INT))
);
}
}

@ -0,0 +1,49 @@
<?php
include('Connection.php');
Class QuoteGateway{
private Connection $con;
public function __construct(Connection $con){
$this->con=$con;
}
public function searchQuote(string $quote,int $numpage,string $language):array{
//recherche par citation
$query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE content LIKE '%:quote%' AND isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
$this->con->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
public function searchSource(string $source,int $numpage,string $language):array{
//recherche par source
$query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE s.title LIKE '%:source%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
$this->con->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
public function searchPers(string $Carac,int $numpage,string $language):array{
//recherche par personnage
$query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE c.caracter LIKE '%:pers%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;";
$this->con->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
public function getComment(int $id):array{
//obtention des commentaire d'une citation
$query="SELECT c.id_comment u.username, u.imgPath, c.comment, c.date FROM Commentary c JOIN Quote q ON c.quote = q.id_quote JOIN User u ON u.id_user = c.user JOIN Image i ON i.id_img = u.img WHERE id_quote = :id;";
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
$result=$this->con->getResults();
return $result;
}
}
?>

@ -0,0 +1,116 @@
<?php
require_once "../public/script/Connection.php";
require_once "sourceEntity.php";
class SourceGateway {
private Connection $co;
public function __construct(Connection $co)
{
$this -> co = $co;
}
public function create(sourceEntity $s) : bool
{
$query = "
INSERT INTO Source
VALUES(:id_source, :title, :date)
";
return $this -> co -> executeQuery($query, [
"id_source" => array($s->getIdSource(), PDO::PARAM_INT),
"title" => array($s->getTitle(), PDO::PARAM_STR),
"date" => array($s->getDate(), PDO::PARAM_STR)
]);
}
public function findById(int $id) : ?sourceEntity
{
$query = "SELECT * FROM Source WHERE id_source = :id";
$this -> co -> executeQuery($query, array("id_source" => array($id, PDO::PARAM_INT)));
$res = $this -> co -> getResults();
if ($res)
return new sourceEntity(
$res["id_source"],
$res["title"],
$res["date"]
);
return null;
}
public function findByTitle(string $t) : ?sourceEntity
{
$query = "SELECT * FROM Source WHERE title = :t";
$this -> co -> executeQuery($query, ["title" => array($t, PDO::PARAM_STR)]);
$res = $this -> co -> getResults();
if ($res)
return new sourceEntity(
$res["id_source"],
$res["title"],
$res["date"]
);
return null;
}
public function findByDate(string $d) : ?sourceEntity
{
$query = "SELECT * FROM Source WHERE date = :d";
$this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]);
$res = $this -> co -> getResults();
if ($res)
return new sourceEntity(
$res["id_source"],
$res["title"],
$res["date"]
);
return null;
}
public function findAll() : array
{
$query = "SELECT * FROM Source";
$this -> co -> executeQuery($query);
$res = $this -> co -> getResults();
$sources = [];
foreach ($res as $source) {
$sources[] = new sourceEntity(
$source["id_source"],
$source["title"],
$source["date"]
);
}
return $sources;
}
public function delete(int $id) : bool
{
$query = "DELETE FROM Source WHERE id_source = :id_s";
$this -> co -> executeQuery($query, ["id_s" => array($id, PDO::PARAM_INT)]);
}
public function update(sourceEntity $s) : bool
{
$query = "
UPDATE Source
SET title = :t, date = :d
WHERE id_source = :id_s
";
return $this->co->executeQuery($query, [
"id_s" => array($s -> getIdSource(), PDO::PARAM_INT),
"t" => array($s -> getTitle(), PDO::PARAM_STR),
"d" => array($s -> getDate(), PDO::PARAM_STR)
]);
}
}

@ -0,0 +1,43 @@
<?php
include('Connection.php');
Class UserGateway{
private Connection $con;
public function __construct(Connection $con){
$this->con=$con;
}
public function insert(string $username,string $email,string $passwd):string{
// récupération id
$query='SELECT id_user FROM Users WHERE id_user >= ALL (SELECT id_user FROM Users);';
$this->con->executeQuery($query);
$result=$this->con->getResults();
foreach($result as $row){
$id=$row['id_user'] + 1;
}
// insertion user
$query='INSERT INTO Users VALUES (:id,:username,:email,:passwd,CURRENT_DATE,false);';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR),':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwd,PDO::PARAM_STR)));
return $id;
}
public function delete(string $id) : bool{
// supretion user
$query='DELETE FROM Users WHERE id_user = :id;';
return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
}
public function getFavorite(string $id):array{
//obtention favoris d'un user
$query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
}
?>

@ -0,0 +1,54 @@
<?php
require_once "characterEntity.php";
require_once "characterGateway.php";
class CharacterModel
{
private characterGateway $gateway;
public function __construct(characterGateway $gateway)
{
$this -> gateway = $gateway;
}
public function createCharacter(int $id_character, string $name , string $img_path) : bool
{
$q = new CharacterEntity($id_character, $name, $img_path);
return $this -> gateway -> create($q);
}
public function getCharacterById(int $id_character) : ?CharacterEntity
{
return $this -> gateway -> findById($id_character);
}
public function getCharacterByName(string $name) : ?CharacterEntity
{
return $this -> gateway -> findByName($name);
}
public function getAllCharacters() : array
{
return $this -> gateway -> findAll();
}
public function deleteCharacter(int $id_character) : bool
{
return $this -> gateway -> delete($id_character);
}
public function updateCharacter(int $id_character, string $name, string $img_path) : bool
{
$q = $this -> gateway -> findById($id_character);
if($q){
$q -> setName($name);
$q -> setImgPath($img_path);
return $this -> gateway -> update($q);
}
return false;
}
}

@ -0,0 +1,42 @@
<?php
require_once "commentaryEntity.php";
require_once "commentaryGateway.php";
class CommentaryModel {
private commentaryGateway $gw;
function __construct(commentaryGateway $gw) {
$this->gw = $gw;
}
public function createComment(int $id_comment, string $comment, string $date): bool {
$c = new CommentaryEntity($id_comment, $comment, $date);
return $this->gw->create($c);
}
public function getComment(int $id_comment): ?commentaryEntity {
return $this -> gw -> findById($id_comment);
}
public function getComments(): array {
return $this -> gw -> findAll();
}
public function deleteComment(int $id_comment): bool {
return $this -> gw -> delete($id_comment);
}
public function updateComment(int $id_comment, string $comment): bool {
$c = $this -> gw -> findById($id_comment);
if($c){
$c -> setComment($comment);
return $this->gw -> update($c);
}
return false;
}
}

@ -0,0 +1,19 @@
<?php
require_once($rep.$entity['quote']);
require_once($rep.$gateway['quote']);
class QuoteModel
{
private QuoteGateway $gateway;
public function __construct(QuoteGateway $gate){
$this->gateway = $gate;
}
public function searchQuote(string $quote,int $numpage,string $language) : Quote{
$res = $this->gateway->searchQuote($quote,$numpage,$language);
return new Quote($res[0]['']);
}
}
?>

@ -0,0 +1,61 @@
<?php
require_once "sourceEntity.php";
require_once "sourceGateway.php";
class SourceModel
{
private sourceGateway $gateway;
public function __construct(SourceGateway $gateway)
{
$this -> gateway = $gateway;
}
public function createSource(int $id_source, string $title, string $date) : bool
{
$q = new SourceEntity($id_source , $title, $date);
return $this -> gateway -> create($q);
}
public function getSourceById(int $id_source) : ?SourceEntity
{
return $this -> gateway -> findById($id_source);
}
public function getSourceByTitle(string $title) : ?SourceEntity
{
return $this -> gateway -> findByTitle($title);
}
public function getSourceByDate(string $date) : ?SourceEntity
{
return $this -> gateway -> findByDate($date);
}
public function getSources() : array
{
return $this -> gateway -> findAll();
}
public function deleteSource(int $id_source) : bool
{
return $this -> gateway -> delete($id_source);
}
public function updateSource(int $id_source, string $title, string $date) : bool
{
$q = $this -> gateway -> findById($id_source);
if ($q){
$q -> setTitle($title);
$q -> setDate($date);
return $this -> gateway -> update($q);
}
return false;
}
}

@ -0,0 +1,33 @@
<?php
require_once($rep.$entity['user']);
require_once($rep.$entity['quote']);
require_once($rep.$gateway['user']);
class UserModel
{
private UserGateway $gateway;
public function __construct(UserGateway $gate){
$this->gateway = $gate;
}
public function insertUser(string $username,string $email,string $passwd) : User{
global $rep,$image;
$id = $this->gateway->insert($username,$email,$passwd);
$u = new User($id,$usename,$passwd,$rep.$image['default'],$email);
}
public function deletUser(string $id) : bool{
return $this->gateway->delete($id);
}
// public function getFavoriteUser(string $id) : array{
// $res = array();
// $data = $this->gateway->getFavorite($id);
// foreach ($data as $favoris) {
// $res[] = new Quote();
// }
// }
}
?>

@ -1,4 +0,0 @@
TesteurFichier
motDepasseFichier
../images/imageProfil.png
testeurFichier.compte@wikifantasy.com

@ -0,0 +1,64 @@
<?php
class CitationView {
public static function display($citationDuJour, $suggestions) {
echo "<div class='citations-section'>";
// Afficher la citation du jour
if ($citationDuJour) {
$quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ
$movie = htmlspecialchars(trim($citationDuJour[2]));
$character = htmlspecialchars(trim($citationDuJour[3]));
$year = htmlspecialchars(trim($citationDuJour[4]));
$imagePath = htmlspecialchars(trim($citationDuJour[5]));
echo "<h2>Citation du jour</h2>";
echo "<div class='citation-container citation-du-jour'>";
echo "<img src='$imagePath' alt='$movie' class='citation-image'>";
echo "<div class='text-content'>";
echo "<p class='quote'>\"$quote\"</p>";
echo "<p class='movie'>- $movie</p>";
echo "<p class='character'>Personnage : $character</p>";
echo "<p class='year'>Année : $year</p>";
echo "</div>";
echo "</div>";
} else {
echo "<p class='error'>Aucune citation du jour n'a été trouvée.</p>";
}
// Filtrer les suggestions pour éviter de reprendre la citation du jour
$filteredSuggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) {
// Vérifie que les deux citations ne sont pas identiques
return isset($suggestion[0]) && trim($suggestion[0]) !== trim($citationDuJour[1]);
});
// Afficher les suggestions
if (!empty($filteredSuggestions)) {
echo "<h2>Suggestions</h2>";
echo "<div class='suggestions-container'>"; // Conteneur pour gérer les colonnes
foreach ($filteredSuggestions as $suggestion) {
// Vérifier si tous les éléments requis sont bien présents dans $suggestion
$quote = isset($suggestion[0]) ? htmlspecialchars(trim($suggestion[0])) : '';
$movie = isset($suggestion[1]) ? htmlspecialchars(trim($suggestion[1])) : '';
$character = isset($suggestion[2]) ? htmlspecialchars(trim($suggestion[2])) : 'Inconnu';
$year = isset($suggestion[3]) ? htmlspecialchars(trim($suggestion[3])) : 'Inconnue';
$imagePath = isset($suggestion[4]) ? htmlspecialchars(trim($suggestion[4])) : 'images/default.jpg';
echo "<div class='citation-container suggestion'>";
echo "<img src='$imagePath' alt='$movie' class='citation-image'>";
echo "<div class='text-content'>";
echo "<p class='quote'>\"$quote\"</p>";
echo "<p class='movie'>- $movie</p>";
echo "<p class='character'>- Personnage : $character</p>";
echo "<p class='year'>- Année : $year</p>";
echo "</div>";
echo "</div>";
}
echo "</div>"; // Fin du conteneur suggestions
}
echo "</div>"; // Fin de la section des citations
echo "</body></html>"; // Clôture la structure HTML
}
}

@ -0,0 +1,37 @@
<?php
class HeaderView {
public static function display($theme) {
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wiki Fantasy</title>
<link id="favicon" rel="icon" href="../images/dark.svg" type="image/x-icon" />
<script src="../script/truncateQuotes.js"></script>
<link rel="stylesheet" href="<?php global $rep,$style; echo $rep.$style['accueil']; ?>"> <!-- Import de styleAccueil.css -->
<script defer src="../script/theme-toggle.js"></script> <!-- Import du script -->
</head>
<body class="<?php echo htmlspecialchars($theme); ?>">
<div class="container">
<div class="header">
<div class="nav">
<a href="favorite.html"><img src="../../images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="../images/dark.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="quiz.html"><img src="../../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
</div>
<div class="logo">
<a href="accueil.html"><img src="../../images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<a href="profil.html"><img src="../../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
</div>
</div>
<?php
}
}
?>

@ -0,0 +1,5 @@
<?php
require (__DIR__.'/HeaderView.php');
//require ($rep.$vues['bandeau']);
//require ($rep.$vues['citation']);
?>
Loading…
Cancel
Save