From db677f8e15ccb8078f59330835ee854f45be292c Mon Sep 17 00:00:00 2001 From: AmarOk Date: Fri, 11 Dec 2015 18:03:55 +0100 Subject: [PATCH 1/3] begin add Event --- addEvent.php | 8 +++++++- databaseOperations.php | 23 +++++++++++++++++++++++ eventAdded.php | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 eventAdded.php diff --git a/addEvent.php b/addEvent.php index 3de851d..42e9b02 100644 --- a/addEvent.php +++ b/addEvent.php @@ -1,3 +1,9 @@ + + @@ -21,7 +27,7 @@

Ajouter un Évènement

-
+
Titre :

diff --git a/databaseOperations.php b/databaseOperations.php index 86f8f23..cedc9d9 100755 --- a/databaseOperations.php +++ b/databaseOperations.php @@ -237,4 +237,27 @@ function getEventsSince($db,$date) die(); } } + +function addEvent($db, $titre, $localisation, $dtstart, $dtend, $description, $url, $urlImage, $contact) +{ + try + { + $request = $db->prepare('INSERT INTO event(event_title, event_localisation, event_dtstart , event_dtend, event_description, event_url, event_urlImage, event_contact) VALUES(:title, :localisation, :dstart, :dtend, :description, :url, :urlImage, :contact)'); + $request->execute(array('title'=>$titre, + 'localisation'=>$localisation, + 'dtend'=>date("Y-m-d hh:mm:ss",$dtstart), + 'dstart'=>date("Y-m-d hh:mm:ss",$dtend), + 'description'=>$description, + 'url'=>$url, + 'urlImage'=>$urlImage, + 'contact'=>$contact)); + $request->closeCursor(); + } + catch(PDOException $e) + { + //NOTE: change $e->getMessage() by an error message before going to production + echo($e->getMessage()); + die(); + } +} ?> diff --git a/eventAdded.php b/eventAdded.php new file mode 100644 index 0000000..a85bf75 --- /dev/null +++ b/eventAdded.php @@ -0,0 +1,40 @@ + + + + + + Kiwi Calendar : Ajouter un évènement + + + + + + + + + + +
+ logo ESIR + +
+ +
+ Ok ! +
+ + From 18a9d6cb5508020354919e37e8ecc54ed492b849 Mon Sep 17 00:00:00 2001 From: AmarOk Date: Thu, 17 Dec 2015 09:27:41 +0100 Subject: [PATCH 2/3] add some events --- populateDatabase.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/populateDatabase.sql b/populateDatabase.sql index bf6ec4a..39fd380 100644 --- a/populateDatabase.sql +++ b/populateDatabase.sql @@ -22,3 +22,6 @@ INSERT INTO categorie(sous_cat_id, cat_title) VALUES(2, "Labfab"); INSERT INTO event VALUES (1, "Porte Ouverte Inria", "INRIA Rennes", "2015-12-10", "2015-12-10", "L'Inria ouvre ses portes aux étudiants !", "http://po.irisa.fr/", "http://www.lirmm.fr/DEMAR/images/inria_corpo_rvb.jpg", "contact@irisa.fr"); INSERT INTO event VALUES (2, "Inpol", "ESIR, Rennes", "2015-12-10 09:00:00", "2015-12-10 12:00:00", "Cours d'innovation et politique", NULL, "https://esir.univ-rennes1.fr/sites/esir.univ-rennes1.fr/themes/esir/logo.png", NULL); INSERT INTO event VALUES (3, "Festival film animation", "Bruz, France", "2015-12-07 09:00:00", "2015-12-13 20:00:00", "Festival national du film d'animation", "http://festival-film-animation.fr/", "http://festival-film-animation.fr/cache/com_unitehcarousel/films_en_bretagne_logo_site_150x150_exact_images-2015.jpg", "communication@afca.asso.fr"); +INSERT INTO event VALUES (4, "Noel", "Esir, Rennes, France", "2015-12-17 19:00:00", "2015-12-13 23:00:00", "Soirée de Noel de l'ISATI dans le hall de l'ESIR !", "http://isati.istic.univ-rennes1.fr/", "http://isati.istic.univ-rennes1.fr/assets/images/isati.png", "communication@isati.org"); +INSERT INTO event VALUES (5, "Noel", "Village du pere noel, Finlande", "2015-12-23 19:00:00", "2015-12-25 23:00:00", "Soirée de Noel", "http://jepasseunnoeltropswagi.net", "https://images.duckduckgo.com/iu/?u=http%3A%2F%2Ffarahlafee.f.a.pic.centerblog.net%2F074e7416.gif&f=1", "papa@noel.org"); +INSERT INTO event VALUES (6, "Nouvel An", "Tour Eiffel, Paris", "2015-12-31 19:00:00", "2016-01-01 23:00:00", "Nouvel an", "http://jepasseunnouvelantropswagi.net", "https://images.duckduckgo.com/iu/?u=http%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.M5cb70d969f54c82b06e77edc0c11e81eo0%26pid%3D15.1&f=1", ""); From 9d5959a709eabc9df1f10dc4342ab24c903fda63 Mon Sep 17 00:00:00 2001 From: AmarOk Date: Thu, 17 Dec 2015 09:44:01 +0100 Subject: [PATCH 3/3] addEvent --- databaseOperations.php | 1 + eventAdded.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/databaseOperations.php b/databaseOperations.php index cedc9d9..618c50f 100755 --- a/databaseOperations.php +++ b/databaseOperations.php @@ -251,6 +251,7 @@ function addEvent($db, $titre, $localisation, $dtstart, $dtend, $description, $u 'url'=>$url, 'urlImage'=>$urlImage, 'contact'=>$contact)); + echo("debug"); $request->closeCursor(); } catch(PDOException $e) diff --git a/eventAdded.php b/eventAdded.php index a85bf75..a0edb5c 100644 --- a/eventAdded.php +++ b/eventAdded.php @@ -2,14 +2,14 @@ include_once('databaseOperations.php'); include('datetimeOperations.php'); $db = connect(); -$titre = $_POST(['title']); -$localisation = $_POST(['address']); -$dtstart = $_POST(['dtstart']); -$dtend = $_POST(['dtend']); -$description = $_POST(['description']); -$url = $_POST(['site']); -$urlImage = $_POST(['urlImage']); -$contact = $_POST(['contact']); +$titre = $_POST['title']; +$localisation = $_POST['address']; +$dtstart = $_POST['dtstart']; +$dtend = $_POST['dtend']; +$description = $_POST['description']; +$url = $_POST['site']; +$urlImage = $_POST['urlImage']; +$contact = $_POST['contact']; addEvent($db, $titre, $localisation, $dtstart, $dtend, $description, $url, $urlImage, $contact); ?>