smarty ça casse les couilles zebi
This commit is contained in:
parent
b1960b2f35
commit
aec3c845e0
469 changed files with 53465 additions and 69 deletions
115
views/project.php
Normal file
115
views/project.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
require_once('../app/controllers/project_controller.php');
|
||||
require_once('../app/models/project_model.php');
|
||||
require_once('../app/entities/project_entity.php');
|
||||
|
||||
//Variable data
|
||||
$_SESSION['title'] = $_POST['titleProject']??"";
|
||||
$_SESSION['description'] = $_POST['descProject']??"";
|
||||
$_SESSION['content'] = $_POST['textProject']??"";
|
||||
$_SESSION['thumbnail'] = $_FILES['imageProject']['name']??"";
|
||||
$_SESSION['status'] = 'en_attente';
|
||||
|
||||
|
||||
$objProject = new Project();
|
||||
$objProjectModel = new ProjectModel();
|
||||
|
||||
/**
|
||||
/* Créer par Besnik le GOAT et l'autre GOAT de Guillaume
|
||||
/*
|
||||
/* @return bool pour savoir si le fichier existe,
|
||||
/* puis déplace vers le fichier uploads avec les images projet des utilisateurs
|
||||
/* Communication avec la BDD
|
||||
*/
|
||||
if (($_SESSION['thumbnail'] != null)){
|
||||
$strDest = "";
|
||||
if ((count($_FILES) > 0) && ($_FILES['imageProject']['error'] != 4)){
|
||||
$strDest = '../public/uploads/projects/'.$_FILES['imageProject']['name'];
|
||||
var_dump($strDest);
|
||||
move_uploaded_file($_FILES['imageProject']['tmp_name'], $strDest);
|
||||
}
|
||||
}
|
||||
|
||||
/** En cas d'appuis sur le bouton d'envoie ou celui de remettre a plus tard
|
||||
/* 1. Changement de status
|
||||
/* 2. Hydratation avec les informations récupéré de l'utilisateur
|
||||
/* 3. Envoie des données à la BDD
|
||||
*/
|
||||
if (isset($_POST['sendMessage'])) {
|
||||
$_SESSION['status'] = 'publié';
|
||||
$objProject->hydrate($_SESSION);
|
||||
$objProject->setThumbnail($strDest);
|
||||
$objProjectModel->insert($objProject);
|
||||
|
||||
} else if (isset($_POST['toContinue'])) {
|
||||
$objProject->hydrate($_SESSION);
|
||||
$objProject->setThumbnail($strDest);
|
||||
$objProjectModel->insert($objProject);
|
||||
}
|
||||
|
||||
//Débuggage
|
||||
var_dump($_SESSION);
|
||||
var_dump($objProject);
|
||||
|
||||
|
||||
?>
|
||||
<body>
|
||||
<section class="container mt-5 p-5 d-flex flex-column align-items-center">
|
||||
<div>
|
||||
<h2>Alimenter votre projet</h2>
|
||||
<form method="post">
|
||||
<button type="submit" class="btn btn-primary btn-lg" name="showForm">+</button>
|
||||
<?php if (isset($_POST['toContinue'])) { ?>
|
||||
<button type="submit" class="btn btn-warning btn-lg" name="showFormContinue">Reprendre</button>
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<?php // Affichage d'un formulaire en cas d'appuie sur le bouton "+"
|
||||
if ((isset($_POST["showForm"])) || (isset($_POST['showFormContinue']))) {?>
|
||||
<form method="post" enctype="multipart/form-data" onsubmit="return confirm('Voulez-vous vraiment envoyer le formulaire ?')">
|
||||
<div>
|
||||
<label>Titre</label>
|
||||
<input type="text" name="titleProject">
|
||||
</div>
|
||||
<div>
|
||||
<label>Description</label>
|
||||
<input type="text" name="descProject">
|
||||
</div>
|
||||
<div>
|
||||
<label>Texte Portfolio</label>
|
||||
<input type="text" name="textProject">
|
||||
</div>
|
||||
<div>
|
||||
<input name="imageProject" class="form-control" type="file">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-md" name="sendMessage">Envoyer</button>
|
||||
<button type="submit" class="btn btn-warning btn-md" name="toContinue">Remettre à plus tard</button>
|
||||
</form>
|
||||
<?php }; ?>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<h3>Description</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Photos behind the scene</h3>
|
||||
<div class="row mb-2">
|
||||
<img>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Other projects</h3>
|
||||
<div class="row mb-2">
|
||||
<?php
|
||||
foreach($arrProjectToDisplay as $objProject){
|
||||
include("../app/views/partials/preview.php");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue