Browse Source

begin add Event

master
AmarOk 10 years ago
parent
commit
db677f8e15
3 changed files with 70 additions and 1 deletions
  1. +7
    -1
      addEvent.php
  2. +23
    -0
      databaseOperations.php
  3. +40
    -0
      eventAdded.php

+ 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>


+ 23
- 0
databaseOperations.php View File

@ -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();
}
}
?>

+ 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>

Loading…
Cancel
Save