Début de la fonctionnalité de dépôt de Img dans le projet
This commit is contained in:
parent
4e9b27772b
commit
1df2ed36a5
35 changed files with 2014 additions and 168 deletions
|
|
@ -23,9 +23,20 @@
|
|||
*/
|
||||
|
||||
public function home(){
|
||||
|
||||
|
||||
$intCategory = 0;
|
||||
if (!empty($_GET['filter_cat'])) {
|
||||
$intCategory = (int) $_GET['filter_cat'];
|
||||
}
|
||||
|
||||
$boolOld = false;
|
||||
if (!empty($_GET['filter_old']) && $_GET['filter_old'] == 'true') {
|
||||
$boolOld = true;
|
||||
}
|
||||
|
||||
$objProjectModel = new ProjectModel;
|
||||
$arrProject = $objProjectModel->findAll();
|
||||
$arrProject = $objProjectModel->findAll(0,'',0,0,'','','',$intCategory,$boolOld);
|
||||
$arrProjectToDisplay = array();
|
||||
foreach($arrProject as $arrDetProject){
|
||||
$objProject = new Project;
|
||||
|
|
@ -34,8 +45,6 @@
|
|||
}
|
||||
|
||||
$this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay;
|
||||
|
||||
|
||||
$this->_display("home");
|
||||
|
||||
}
|
||||
|
|
@ -43,8 +52,8 @@
|
|||
/**
|
||||
* Fonction d'affichage de la barre de recherche
|
||||
*/
|
||||
|
||||
public function search(){
|
||||
|
||||
//Récupérer les informations du formulaire
|
||||
$strKeywords = $_POST['keywords']??'';
|
||||
$intAuthor = $_POST['author']??0;
|
||||
|
|
@ -87,8 +96,6 @@
|
|||
/**
|
||||
* Fonction d'affichage de la page projet
|
||||
*/
|
||||
|
||||
|
||||
public function project (){
|
||||
|
||||
$objProjectModel = new ProjectModel;
|
||||
|
|
@ -112,33 +119,33 @@
|
|||
$_SESSION['title'] = $_POST['titleProject']??"";
|
||||
$_SESSION['description'] = $_POST['descProject']??"";
|
||||
$_SESSION['content'] = $_POST['textProject']??"";
|
||||
$_SESSION['thumbnail'] = $_FILES['imageProject']['name']??"";
|
||||
$_SESSION['thumbnail'] = $_FILES['imageThumbnail']['name']??"";
|
||||
$_SESSION['status'] = 'en_attente';
|
||||
|
||||
|
||||
$objProject = new Project();
|
||||
|
||||
/**
|
||||
/* 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
|
||||
* 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'];
|
||||
$strDest = '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
|
||||
*/
|
||||
* 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);
|
||||
|
|
@ -151,14 +158,12 @@
|
|||
$objProjectModel->insert($objProject);
|
||||
}
|
||||
|
||||
//Débuggage
|
||||
var_dump($_SESSION);
|
||||
var_dump($objProject);
|
||||
$this->_arrData['arrProjectToDiplay'] = $arrProjectToDiplay;
|
||||
$this->_arrData['arrImageToDiplay'] = $arrImageToDiplay;
|
||||
|
||||
$this->_display("project");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue