From cdf0c2fe679d24e716b5cedbbd1b8bd71a9a37cb Mon Sep 17 00:00:00 2001 From: Lex Date: Fri, 11 Mar 2016 11:35:34 +0100 Subject: [PATCH] add project --- admin123/admin.php | 37 ++++++++++++++++++++++++++++++++++++- lib/project.php | 25 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/admin123/admin.php b/admin123/admin.php index 9054748..b032724 100644 --- a/admin123/admin.php +++ b/admin123/admin.php @@ -1,6 +1,9 @@ @@ -30,12 +51,26 @@ if (isset($_SESSION['user'], $_SESSION['password'])) {

Administration

Bonjour

-
+

Gestion des projets

+ +

Ajouter un projet sans mettre d'image parce que c'est trop long est chiant à faire

+ +
+ + + + + + +
+ +

Liste des projets

+ diff --git a/lib/project.php b/lib/project.php index 4733718..de98e87 100644 --- a/lib/project.php +++ b/lib/project.php @@ -64,6 +64,31 @@ function getProject($id) return $query->fetch(); } +/** + * Enregistre un nouveau projet + * + * @param string $name Nom du projet + * @param string $description description du projet + */ +function createProject($name, $description, DateTime $date) +{ + $pdo = getDatabaseConnection(); + + $query = $pdo->prepare( + 'insert into project(title, illustration, description, date) + value(:title, :illustration, :description, :date)' + ); + + $illustration = "Craypions005.jpg"; + + $query->execute([ + ':title' => $name, + ':illustration' => $illustration, + ':description' => $description, + ':date' => $date->format('Y-m-d H:i:s'), + ]); +} + /** * @param int $maxPerPage Nombre de projets par page * @return int Le nombre de pages