Skip to content
Extraits de code Groupes Projets
Valider 533a8c0e rédigé par Animation des soirees's avatar Animation des soirees
Parcourir les fichiers

add calendar notion

parent 5bedfd27
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<?php
$samPics = array('sam1.jpg', 'sam2.jpg', 'sam3.jpg', 'sam4.jpg');
$sam = $samPics[array_rand($samPics)];
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/links/common.css">
<meta charset="UTF-8">
</head>
<body>
<div class="header">
<img src="assets/sam/<?php echo $sam; ?>" style="margin:auto">
</div>
......@@ -5,35 +5,53 @@ require 'Slim/Slim.php';
$app = new \Slim\Slim();
$bdd = new PDO('mysql:host=mysql.iiens.net;dbname=assoce_nightiies', 'assoce_nightiies', 'CQX2K3BZctUAvUtz', array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
$samPics = array('sam1.jpg', 'sam2.jpg', 'sam3.jpg', 'sam4.jpg');
$app->get(
'/',
function () {
global $samPics;
global $bdd;
$sam = $samPics[array_rand($samPics)];
$chans = $bdd->prepare('SELECT name, id
FROM sam_calendars
');
$chans->execute();
include('includes/header.php');
echo <<<EOF
<div class="content">
<p>Calendrier disponibles : </p>
<ul>
EOF;
while ($chan = $chans->fetch()) {
echo '<li><a href="'.$chan[1].'">'.$chan[0].'</a></li>';
}
echo <<<EOF
</ul>
</div>
</body>
</html>
EOF;
}
);
$app->get(
'/:calendar',
function ($calendar) {
global $bdd;
$events = $bdd->prepare('SELECT s.id, title,
DATE_FORMAT(date, "%d/%m/%Y"), place, description, link, GROUP_CONCAT(nick SEPARATOR ", ") as nicks
FROM sam s
LEFT OUTER JOIN sam_users su ON s.id = su.event
WHERE s.date >= NOW()
WHERE s.date >= NOW() AND s.calendar_id = ?
GROUP BY s.id
ORDER BY date');
$events->execute();
$events->execute(array($calendar));
include('includes/header.php');
echo <<<EOF
<html>
<head>
<link rel="stylesheet" type="text/css" href="/links/common.css">
<meta charset="UTF-8">
</head>
<body>
<div class="header">
<img src="assets/sam/$sam" style="margin:auto">
</div>
<div class="content">
<p>
Calendrier ICS (importable dans toutes application agenda digne de ce nom) : <a href="http://nightiies.iiens.net/sam/events.php">calendar.ics</a>. Un argument GET « nick » peut être ajouter à l'URL pour filtrer les soirées.
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter