Browse Source

bugfix with getEventByDate

master
n0m1s 10 years ago
parent
commit
e681ee5f7d
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      databaseOperations.php
  2. +3
    -3
      day.php
  3. +1
    -1
      index.php

+ 2
- 2
databaseOperations.php View File

@ -164,7 +164,7 @@ function getCategoriesForOneEvent($db, $eventId)
/** /**
* @brief queries the database for the events on a certain date * @brief queries the database for the events on a certain date
* @param $db: the PDO connection to the database * @param $db: the PDO connection to the database
* @param $date: the date to search for
* @param $date: the date to search for (please use strtotime)
* @return a list of all the events at the date $date * @return a list of all the events at the date $date
*/ */
function getEventsByDate($db, $date) function getEventsByDate($db, $date)
@ -172,7 +172,7 @@ function getEventsByDate($db, $date)
try try
{ {
$request = $db->prepare('SELECT * FROM event WHERE (event_dtstart <= :date AND event_dtend >= :date)'); $request = $db->prepare('SELECT * FROM event WHERE (event_dtstart <= :date AND event_dtend >= :date)');
$request->execute(array('date'=>date("Y-m-d",strtotime($date))));
$request->execute(array('date'=>date("Y-m-d",$date)));
$result = $request->fetchAll(); $result = $request->fetchAll();
$request->closeCursor(); $request->closeCursor();
return $result; return $result;


+ 3
- 3
day.php View File

@ -2,7 +2,7 @@
include_once('databaseOperations.php'); include_once('databaseOperations.php');
$db = connect(); $db = connect();
$date = htmlspecialchars($_GET['date']);
$date = strtotime(htmlspecialchars($_GET['date']));
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -21,14 +21,14 @@ $date = htmlspecialchars($_GET['date']);
</header> </header>
<div id="descEvent"> <div id="descEvent">
<h1><?php echo date('d M Y',strtotime($date)); ?></h1>
<h1><?php echo date('d M Y', $date); ?></h1>
<?php <?php
$ret = getEventsByDate($db, $date); $ret = getEventsByDate($db, $date);
//Show events //Show events
foreach ($ret as $row) foreach ($ret as $row)
{ {
echo "<div id=\"event\">\n"; echo "<div id=\"event\">\n";
echo "<h2>".$row['event_title']."</h2>\n";
echo "<h2>".$row['event_titre']."</h2>\n";
echo "<div id=\"dateLieu\">".date('H:i',strtotime($row['event_dtstart']))." - ".date('H:i',strtotime($row['event_dtend'])).". ".$row['event_localisation']."</div>\n"; echo "<div id=\"dateLieu\">".date('H:i',strtotime($row['event_dtstart']))." - ".date('H:i',strtotime($row['event_dtend'])).". ".$row['event_localisation']."</div>\n";
echo "<div id=\"descfull\">".$row['event_description'] ."</div>\n<div id=\"More\"><a href=\"\">En savoir +</a></div>\n</div>\n"; echo "<div id=\"descfull\">".$row['event_description'] ."</div>\n<div id=\"More\"><a href=\"\">En savoir +</a></div>\n</div>\n";
} }


+ 1
- 1
index.php View File

@ -143,7 +143,7 @@ else
<ul>'); <ul>');
foreach($events as $event) foreach($events as $event)
echo('<li class="calendar-link"><a href="./event.php?id='.$event['event_id'].'">'.$event['event_title']."</a></li>");
echo('<li class="calendar-link"><a href="./event.php?id='.$event['event_id'].'">'.$event['event_titre']."</a></li>");
echo(' echo('
</ul> </ul>
</li>'); </li>');


Loading…
Cancel
Save