index.php 839 Bytes
Newer Older
JonathanMM's avatar
JonathanMM committed
1 2 3
<?php
require_once('config.php');
include_once('functions.php');
4 5 6
require_once('libs/Smarty.class.php');

$smarty = new Smarty();
JonathanMM's avatar
JonathanMM committed
7 8 9 10 11 12 13 14 15

//Filtre 24 heures
$hier = new DateTime("-1day");
$filtreDate = $hier->format('Y-m-d H:i:s');

//Dernière conso
$requete = $pdo->query('SELECT * FROM `statusConso` where nbStation Is not null and date >= "'.$filtreDate.'" Order by id desc limit 0,1');
$conso = $requete->fetch();

16 17 18 19 20 21 22 23
$smarty->assign(array(
    'idConso' => $conso['id'],
    'nbStation' => $conso['nbStation'],
    'nbStationDetecte' => $conso['nbStationDetecte'],
    'nbBike' => $conso['nbBike'],
    'nbEbike' => $conso['nbEbike'],
    'nbEDock' => $conso['nbEDock'],
    'nbFreeEDock' => $conso['nbFreeEDock'],
24
    'dateDerniereConso' => (new DateTime($conso['date']))->format('d/m/Y à H:i')
25
));
26

27 28
$smarty->display('index.tpl');
exit();
JonathanMM's avatar
JonathanMM committed
29
?>