changement de dernière minute profil

pull/23/head
kevin.modejar 4 months ago
parent ad9c10e450
commit 74427831a0

@ -12,8 +12,8 @@ $base = '';
$login = '';
$mdp = '';
//$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
$racine='/WF-Website';
$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
//$racine='/WF-Website';
//Vues

@ -15,7 +15,8 @@ if(!isset($_SESSION['theme'])){
require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute');// ('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd')
//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute');
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd');
//twig
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');

@ -7,9 +7,14 @@
--main-dark-other-color : #000000;
--main-light-background-color: #ffffff;
/*--main-light-background-color: #ffffff;*/
--main-light-text-color : #000000;
--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);
--main-light-other-color : #d2d2d8;
--main-light-gradient : linear-gradient(90deg, #78b3eb, #64c1ff);
/*--main-light-gradient : linear-gradient(-90deg, #f3e0f7, #dd9aff);*/
/*--main-light-gradient : linear-gradient(45deg, #73CFF6, #DE95CA);*/
--main-light-other-color : #f8eaff;
/*--main-light-other-color : #f8eaff;*/
/*--main-light-other-color : #d2d2d8;*/
}
/* Général */

@ -34,6 +34,11 @@ body.light-mode .inputPasswd{
color: black;
}
body.dark-mode .saveButtonPasswd {
background: var(--main-dark-gradient);
color: var(--main-dark-text-color);
}
/* ====== LIGHT MODE ====== */
body.light-mode h1{
color : var(--main-light-text-color);
@ -66,6 +71,11 @@ body.light-mode .inputPasswd{
color: black;
}
body.light-mode .saveButtonPasswd {
background: var(--main-light-gradient);
color: var(--main-light-text-color);
}
/* ====== ECRAN DEFAUT ====== */
h1{
@ -102,12 +112,12 @@ p{
.login{
width: 30vw;
height: 78vh;
/*height: 78vh;*/
margin: auto;
margin-top: 17vh;
border-radius: 25px;
padding-top: 1px;
padding-bottom: 1%;
padding-bottom: 2%;
}
.imgModify{
@ -128,6 +138,15 @@ p{
}
.saveButtonPasswd {
display: block;
margin: auto;
padding: 1vh;;
margin-top: 1vh;
border-radius: 25px;
border: none;
}
.ChangeImg{
display: block;
margin: auto;
background: transparent;

@ -16,7 +16,7 @@ Class FrontControler{
global $twig,$racine;
$this->listAction = ['visitor' => array('accueil','search','quote','login','signin','validlogin','validsignin'),
'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit'),
'user' => array('quiz','commentary','logout','addComment','favorite','profil','addFav','supFav','changedata', 'submit', 'validsubmit', 'add'),
'admin' => array('null')];
$dVueEreur = [];
@ -53,6 +53,7 @@ Class FrontControler{
$router->map('GET|POST', '/changedata', 'UserControler','changedata');
$router->map('GET|POST', '/submit', 'UserControler', 'submit');
$router->map('GET|POST', '/validsubmit', 'UserControler', 'validsubmit');
$router->map('GET|POST', '/add', 'UserControler', 'add');
$match = $router->match();

@ -29,6 +29,7 @@ class UserControler {
private QuoteModel $qMod;
private QuestionModel $mdl;
private CharacterModel $caMod;
private SourceModel $srcMod;
public function __construct() {
global $co;
@ -376,4 +377,70 @@ class UserControler {
}
return null;
}
public function add(){
global $vues;
var_dump($_POST);
$error = [];
if($_POST['req'] == "both"){
$src = true;
$char = true;
}
elseif($_POST['req'] == "src"){
$src = true;
$char = false;
$type = array("Movie","Serie","VideoGame","Anime");
if(Verification::verifNotNull($_POST["titre"])){
$_POST["titre"] = Verification::verifChar($_POST["titre"]);
if($this->srcMod->existSource($_POST["titre"],$_POST["type"])){
$error[] = "La source existe déja";
}
}
else{
$error[] = "Le titre doit être définit";
}
if(Verification::verifNotNull($_POST["date"])){
$src = true;
$char = false;
$_POST["date"] = Verification::verifChar($_POST["date"]);
if(intval($_POST["date"],10) < 1850 or intval($_POST["date"],10) > date( "Y", time() )){
$error[] = "La date est invalide";
}
}
else{
$error[] = "La date doit être définit";
}
if(Verification::verifNotNull($_POST["type"])){
$_POST["type"] = Verification::verifChar($_POST["type"]);
if(!in_array($_POST["type"],$type)){
$error[] = "Le type indiquer est inexistant";
}
}
else{
$error[] = "Le type doit être définit";
}
}
elseif($_POST['req'] == "char"){
$src = false;
$char = true;
if(Verification::verifNotNull($_POST[""])){
}
}
if($error == []){
if($_POST['req'] == "both"){
}
elseif($_POST['req'] == "src"){
$this->srcMod->createSource($_POST["titre"], $_POST["date"], $_POST["type"]);
}
elseif($_POST['req'] == "char"){
}
}
else{
require_once($vues["create"]);
var_dump($error);
}
}
}

@ -5,5 +5,5 @@ enum TypeSourceEnum : string {
case Movie = 'movie';
case VideoGame = 'video-game';
case Anime = 'anime';
case TV = 'tv';
case Serie = 'serie';
}

@ -16,7 +16,7 @@ class SourceGateway extends Gateway{
return $this -> co -> executeQuery($query, [
"title" => array($s->getTitle(), PDO::PARAM_STR),
"date" => array($s->getDate(), PDO::PARAM_STR),
"type" => array($s->getType(), PDO::PARAM_STR)
#"type" => array($s->getType(), PDO::PARAM_STR)
]);
}

@ -104,5 +104,9 @@ class SourceModel extends Model
return false;
}
public function existSource(string $name, string $type) : bool{
$q = $this -> getSourceByTitle($name);
return isset($q[0]);
}
}

@ -39,8 +39,8 @@ namespace Verification;
return $tabText;
}
public static function verifNotNull($val){
public static function verifNotNull($val) :bool{
return empty($var);
}
}

@ -1,16 +1,43 @@
<div class="creation">
<form class="add" method="post" action="{{racine}}/add">
{% if src == true and char == true %}
<input type="hidden" id="req" name="req" value="both"/>
{% elseif src == true %}
<input type="hidden" id="req" name="req" value="src"/>
{% elseif char == true %}
<input type="hidden" id="req" name="req" value="src"/>
{% endif %}
{% if src == true %}
<h1>Source</h1>
<label for="titre">Titre de la source *</label>
<input type="text" class="champ" id="titre" name="titre" placeholder="Titre de la source" required/>
<label for="quantity">Année de sortie *</label>
<input type="number" id="quantity" name="quantity" min="1850" max="{{ "now"|date("Y") }}" required>
<input type="text" class="champ" id="titre" name="titre" placeholder="Titre de la source" required/>
<label for="date">Année de sortie *</label>
<input type="number" id="date" name="date" min="1850" max="{{ "now"|date("Y") }}" required>
<label for="type">Type de source *</label>
<input type="radio" id="movie" name="type" value="Movie" checked>
<label for="movie">Film</label><br>
<input type="radio" id="serie" name="type" value="Serie">
<label for="serie">Serie</label>
<input type="radio" id="vg" name="type" value="VideoGame">
<label for="vg">Jeu Vidéo</label><br>
<input type="radio" id="anime" name="type" value="Anime">
<label for="anime">Anime</label>
{% endif %}
{% if char == true %}
<h1>Personnage</h1>
<label for="name">Nom de personnage *</label>
<input type="text" class="champ" id="name" name="name" placeholder="Nom du personnage" required/>
<label for="name">Image du personnage *</label>
<input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg" required/>
{% endif %}
<input type="submit" class="btn" name="action" value="Soumettre"/>
<input type="submit" class="btn" value="Soumettre"/>
</form>
<body>
<html>

@ -3,8 +3,7 @@
<h1>▶ Profil ◀</h1>
<form method="post" action="{{ racine }}/changedata">
{# <img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/> #}
<button name="image" class="saveButtonPasswd" value="1" type="Submit"><img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/></button>
<button name="image" class="ChangeImg" value="1" type="Submit"><img src="{{ srcImg }}" class="imageProfil" onmousedown="return false"/></button>
<p class="infoProfil" name="pseudo" id="username"> <strong>{{ srcUsername }}</strong><img class='imgModify' src='{{ racine }}/images/modify.svg' onclick="editFieldUsername('username')"/></p>
@ -14,7 +13,7 @@
<p class="infoProfil" name="mdp" id="passwd"> <strong>Votre mot de passe</strong><img class='imgModify' src='{{ racine }}/images/modify.svg' onclick="editFieldPassWd('passwd')"/></p>
<div class="languageDiv">
<p class="languageTitle">Language :</p>
</div>
@ -23,7 +22,7 @@
</form>
<div class="createQuote">
<a href="{{racine}}/submit" class="createQuote">Ajouter une citation</a>
<a {#href="{{racine}}/submit"#} class="createQuote">Ajouter une citation</a>
</div>

Loading…
Cancel
Save