diff --git a/day.php b/day.php index 16aff76..f0d7d0d 100644 --- a/day.php +++ b/day.php @@ -21,25 +21,17 @@ echo date('d M Y',strtotime($date)); ?> open('testdb.db'); - } - } - - $db = new MyDB(); - if(!$db) echo $db->lastErrorMsg(); + include_once('databaseOperations.php'); + $db = connect(); $date = $_GET["date"]; - $ret = $db->query('SELECT titre, dtstart, dtend, localisation, description FROM events WHERE dtstart<"'.date('Y-m-d',strtotime($date . "+1 days")).'" AND dtstart>"'.date('Y-m-d',strtotime($date)).'";'); + $ret = getEventsByDate($db, $date); //Show events while($row = $ret->fetchArray(SQLITE3_ASSOC) ) { echo "
\n"; - echo "

".$row['titre']."

\n"; - echo "
".date('H:i',strtotime($row['dtstart']))." - ".date('H:i',strtotime($row['dtend'])).". ".$row['localisation']."
\n"; - echo "
".$row['description'] ."
\n
En savoir +
\n
\n"; + echo "

".$row['event_title']."

\n"; + echo "
".date('H:i',strtotime($row['event_dtstart']))." - ".date('H:i',strtotime($row['event_dtend'])).". ".$row['event_localisation']."
\n"; + echo "
".$row['event_description'] ."
\n
En savoir +
\n\n"; } $db->close(); diff --git a/event.php b/event.php index 9a7f60d..d8a0c00 100755 --- a/event.php +++ b/event.php @@ -12,11 +12,11 @@ $db = new MyDB(); if(!$db) echo $db->lastErrorMsg(); $id = $_GET["id"]; - $ret = $db->query('SELECT * FROM events WHERE id="'. $id .'"'); + $ret = $db->query('SELECT * FROM event WHERE event_id="'. $id .'"'); $event = $ret->fetchArray(SQLITE3_ASSOC); ?> - KiWi calendar : <?php echo $event["titre"]; ?> + KiWi calendar : <?php echo $event["event_title"]; ?> @@ -29,22 +29,22 @@
-

+

Date et lieu

format('Y-m-d') == $dtend->format('Y-m-d')) - echo strftime('Le %d %B %Y, ', strtotime($event['dtstart'])).strftime('de %Hh%M ', strtotime($event['dtstart'])).strftime('à %Hh%M', strtotime($event['dtend'])); + echo strftime('Le %d %B %Y, ', strtotime($event['event_dtstart'])).strftime('de %Hh%M ', strtotime($event['event_dtstart'])).strftime('à %Hh%M', strtotime($event['event_dtend'])); else - echo strftime('Du %d %B %Y, %Hh%M', strtotime($event['dtstart'])).strftime(' à %d %B %Y, %Hh%M',strtotime($event['dtend'])); + echo strftime('Du %d %B %Y, %Hh%M', strtotime($event['event_dtstart'])).strftime(' à %d %B %Y, %Hh%M',strtotime($event['event_dtend'])); ?>
'.$event["localisation"].'
'; - $url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($event["localisation"]).'&key=AIzaSyB8Cd8NP8VOa0wIlvvYGEMZMzCKwROiHxU'; + echo '
'.$event["event_localisation"].'
'; + $url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($event["event_localisation"]).'&key=AIzaSyB8Cd8NP8VOa0wIlvvYGEMZMzCKwROiHxU'; $obj = json_decode(file_get_contents($url), true); $lat = $obj["results"][0]["geometry"]["location"]["lat"]; $lng = $obj["results"][0]["geometry"]["location"]["lng"]; @@ -53,19 +53,19 @@ marginheight="0" marginwidth="0" src="'.$urlFrame.'" style="width:100%;height:500px;margin-bottom:-30px;">'; - if(isset($event["urlImage"]) || isset($event["description"])) - echo '

Description

'; - if(isset($event["urlImage"])) - echo '
'; - if(isset($event["description"])) - echo '
'.$event["description"].'
'; + if(isset($event["event_urlImage"]) || isset($event["event_description"])) + echo '

Description

'; + if(isset($event["event_urlImage"])) + echo '
'; + if(isset($event["event_description"])) + echo '
'.$event["event_description"].'
'; - if(isset($event["site"]) || isset($event["contact"])) + if(isset($event["event_site"]) || isset($event["event_contact"])) echo '

Informations

'; - if(isset($event["site"])) - echo '
URL : '.$event["site"].'
'; - if(isset($event["contact"])) - echo '
Contact : '.$event["contact"].'
'; + if(isset($event["event_site"])) + echo '
URL : '.$event["event_site"].'
'; + if(isset($event["event_contact"])) + echo '
Contact : '.$event["event_contact"].'
'; ?> diff --git a/index.php b/index.php index 9328747..046dc0a 100644 --- a/index.php +++ b/index.php @@ -147,7 +147,7 @@ $categories = getCategories($db); ');