1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<base href="http://www.espaceimagi.be/wp_jerome_de_warzee/agenda-des-spectacles/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agenda spectacles</title>
<style>
html,
body {
margin: 0;
padding: 0;
font: 1em/1.25 Verdana;
}
main {
display: block;
margin: auto;
max-width: 40em;
}
.spectacle {
display: inline-flex;
flex-wrap: wrap;
align-items: start;
width: 100%;
margin: .25em 0;
padding: 0;
min-width: 100%;
border: none;
box-shadow: 0 0 2px #000 inset;
}
.spectacle dl {
flex: 1 0 auto;
box-sizing: border-box;
width: calc(100% - 9em);
margin: 0;
padding: .25em;
min-width: 20em;
}
.spectacle dt,
.spectacle dd {
margin: 0;
}
.affiche {
padding: .25em;
vertical-align: top;
}
.title {
font-size: 1.5em;
font-weight: 700;
line-height: 1.5;
}
.address {
font-size: 1.25em;
}
.tel span,
.mail span {
display: inline-block;
min-width: 12em;
font-size: .9em;
}
.reservation {
margin-top: .5em;
text-align: right;
}
.reservation img {
display: inline-block;
width: 10em;
}
</style>
</head>
<body>
<?php
/** Charger la bibliothèque **/
set_include_path(get_include_path() . PATH_SEPARATOR . './Classes/');
include 'PHPExcel/IOFactory.php';
/** définir le fichier à examiner*/
$inputFileName = './dates.xlsx';
/** On "charge le fichier excel*/
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
/** On dit que c'est la feuille 0 du fichier excell qu'on va utiliser*/
$worksheet=$objPHPExcel->getSheet(0);
/** je met à zero la variable qui va compter les lignes*/
$i=1;
/** On boucle pour passer les lignes en revue*/
foreach ($worksheet->getRowIterator() as $row) {
$i = $row->getrowindex();
/** Ici je met dans les différentes variables le contenu de la cellule concernée pour la ligne en cours*/
$affiche =$worksheet->getCellByColumnAndRow('0',$i)->getCalculatedValue();
$lieu =$worksheet->getCellByColumnAndRow('1',$i)->getCalculatedValue();
$datu =$worksheet->getCellByColumnAndRow('2',$i)->getCalculatedValue();
$heure =$worksheet->getCellByColumnAndRow('3',$i)->getCalculatedValue();
$mail =$worksheet->getCellByColumnAndRow('4',$i)->getCalculatedValue();
$telephone =$worksheet->getCellByColumnAndRow('5',$i)->getCalculatedValue();
$reserve =$worksheet->getCellByColumnAndRow('6',$i)->getCalculatedValue();
$spectacle =$worksheet->getCellByColumnAndRow('7',$i)->getCalculatedValue();
$dati = PHPExcel_Shared_Date::ExcelToPHP($datu);
$dati =date('d-m-Y',$dati);
$dato =date('d-m-Y');
if ((strtotime($dati)>=strtotime($dato)) or (strtotime($dati)>=strtotime($dato) )) /** on regarde si la date de la ligne Excell est dans le passé, si pas on affiche le contenu des variables */
{
echo /** On envoi du HTML pour exploiter le contenu des différentes variables et que ça s'affiche bien*/
<<<HTML
<div class="spectacle">
<img class="affiche" src="$affiche" alt="Affiche spectacle">
<dl>
<dd class="address">{$lieu}
<dt class="title">{$spectacle}
<dd class="date">{$dati} à {$heure}
<dd class="mail"><span>Réserver par mail</span>: <a href="mailto:{$mail}">{$mail}</a>
<dd class="tel"><span>Réserver par Téléphone</span>: <a href="{$telephone}">{$telephone}</a>
<dd class="reservation"><a href="$reserve" target="_blank"><img src="./images/btn3.png" alt="Réservation"></a>
</dl>
</div>
</html>
HTML;
}}
$closeFileName = './dates.xlsx';
?>
</body>
</html> |
Partager