Browse Source

Merge remote-tracking branch 'origin/master'

master
n0m1s 10 years ago
parent
commit
df8d7b0920
4 changed files with 74 additions and 1 deletions
  1. +7
    -1
      addEvent.php
  2. +24
    -0
      databaseOperations.php
  3. +40
    -0
      eventAdded.php
  4. +3
    -0
      populateDatabase.sql

+ 7
- 1
addEvent.php View File

@ -1,3 +1,9 @@
<?php
include_once('databaseOperations.php');
include('datetimeOperations.php');
$db = connect();
?>
<!DOCTYPE html>
<html>
<head>
@ -21,7 +27,7 @@
<div id="descEvent">
<h1>Ajouter un Évènement</h1>
<form id="eventForm" name="eventForm">
<form id="eventForm" name="eventForm" method="post" action="eventAdded.php">
<div id="left">Titre :</div>
<input type="text" name="title">
<br>


+ 24
- 0
databaseOperations.php View File

@ -237,4 +237,28 @@ 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));
echo("debug");
$request->closeCursor();
}
catch(PDOException $e)
{
//NOTE: change $e->getMessage() by an error message before going to production
echo($e->getMessage());
die();
}
}
?>

+ 40
- 0
eventAdded.php View File

@ -0,0 +1,40 @@
<?php
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'];
addEvent($db, $titre, $localisation, $dtstart, $dtend, $description, $url, $urlImage, $contact);
?>
<!DOCTYPE html>
<html>
<head>
<title>Kiwi Calendar : Ajouter un évènement</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./event.css" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen"
href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="./addEvent.css" />
<!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]-->
</head>
<body>
<header id="title">
<img alt="logo ESIR" src="./images/esir.png" />
<a href="./index.php"><img class="rightLogo" alt="logo Kiwi" src="./images/KiWiCalendar.png" /></a>
</header>
<div id="descEvent">
Ok !
</div>
</body>
</html>

+ 3
- 0
populateDatabase.sql View File

@ -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", "");

Loading…
Cancel
Save