Browse Source

Merge branch 'master' of github.com:TheMrNomis/KiWi-calendar

master
AmarOk 10 years ago
parent
commit
991f71885b
6 changed files with 138 additions and 151 deletions
  1. +4
    -3
      databaseOperations.php
  2. +18
    -21
      day.php
  3. +24
    -3
      hamburger.js
  4. +9
    -8
      index.css
  5. +68
    -104
      index.php
  6. +15
    -12
      populateDatabase.sql

+ 4
- 3
databaseOperations.php View File

@ -164,15 +164,16 @@ function getCategoriesForOneEvent($db, $eventId)
/**
* @brief queries the database for the events on a certain date
* @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
*/
function getEventsByDate($db, $date)
{
try
{
$request = $db->prepare('SELECT * FROM event WHERE (event_dtstart <= :date AND event_dtend >= :date)');
$request->execute(array('date'=>date("Y-m-d",$date)));
$request = $db->prepare('SELECT * FROM event WHERE (event_dtstart <= :date_max AND event_dtend >= :date_min)');
$request->execute(array('date_max'=>date("Y-m-d 23:59:59",$date),
'date_min'=>date("Y-m-d 00:00:00",$date)));
$result = $request->fetchAll();
$request->closeCursor();
return $result;


+ 18
- 21
day.php View File

@ -1,3 +1,9 @@
<?php
include_once('databaseOperations.php');
$db = connect();
$date = strtotime(htmlspecialchars($_GET['date']));
?>
<!DOCTYPE html>
<html>
<head>
@ -15,27 +21,18 @@
</header>
<div id="descEvent">
<h1><?php
date_default_timezone_set('America/Los_Angeles');
$date = $_GET["date"];
echo date('d M Y',strtotime($date));
?></h1>
<?php
include_once('databaseOperations.php');
$db = connect();
$date = $_GET["date"];
$ret = getEventsByDate($db, $date);
//Show events
while($row = $ret->fetchArray(SQLITE3_ASSOC) ) {
echo "<div id=\"event\">\n";
echo "<h2>".$row['event_title']."</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=\"descfull\">".$row['event_description'] ."</div>\n<div id=\"More\"><a href=\"\">En savoir +</a></div>\n</div>\n";
}
$db->close();
?>
<h1><?php echo date('d M Y', $date); ?></h1>
<?php
$ret = getEventsByDate($db, $date);
//Show events
foreach ($ret as $row)
{
echo "<div id=\"event\">\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=\"descfull\">".$row['event_description'] ."</div>\n<div id=\"More\"><a href=\"\">En savoir +</a></div>\n</div>\n";
}
?>
</div>
</body>
</html>

+ 24
- 3
hamburger.js View File

@ -3,7 +3,28 @@ var menu = document.getElementById("hamburgerMenu");
var open = false;
button.addEventListener('click', function(){
menu.style.left = (open)? '-382px' : '0px';
open = !open;
button.addEventListener('click', function () {
'use strict';
menu.style.left = (open) ? '-382px' : '0px';
open = !open;
}, false);
var buttonEsir = document.getElementById("ancherESIR");
var buttonRennes = document.getElementById("ancherRennes");
var tab0 = document.getElementById("tab0");
var tab1 = document.getElementById("tab1");
buttonEsir.addEventListener('click', function () {
'use strict';
tab1.style.display = 'none';
tab0.style.display = 'block';
}, false);
buttonRennes.addEventListener('click', function () {
'use strict';
tab0.style.display = 'none';
tab1.style.display = 'block';
}, false);
tab1.style.display = 'none';

+ 9
- 8
index.css View File

@ -95,28 +95,29 @@ input[type="checkbox"]:checked + label span {
#AddEvent
{
margin:0;
margin-top:45px;
text-align:center;
font-size: 20px;
padding-top:15px;
height: 40px;
padding-top:1em;
height: 3em;
width: 100%;
position:absolute;
bottom: 3em;
color: #ffffff;
background-color: #2b2b2b;
}
#container
{
margin-top:120px;
}
#AddEvent:hover
{
color: #2b2b2b;
background-color: #40c1e6;
}
#container
{
margin-top:0px;
padding-top: 40px;
}
#calendar
{
height:100%;


+ 68
- 104
index.php View File

@ -52,89 +52,54 @@ else
<nav id="hamburgerMenu">
<a id="ancherESIR" href="#ESIR" onclick="alert('Click on ESIR');">
<div class="onglet" id="onglet-esir">
Esir
</div>
</a>
<a id="ancherRennes" href="#Rennes" onclick="alert('Click on Rennes');">
<div class="onglet" id="onglet-ext">
Rennes
</div>
</a>
<a id="ancherEvent" href="#addEvent" onclick="alert('Ajoute un evenement');"><div class="Button" id="AddEvent">
+ Ajouter un Évènement
</div></a>
<a id="ancherESIR" href="#">
<div class="onglet" id="onglet-esir">
Esir
</div>
</a>
<a id="ancherRennes" href="#">
<div class="onglet" id="onglet-ext">
Rennes
</div>
</a>
<div id="container">
<form method="post" action="./update-categories.php">
<?php
for($tab = 0; $tab < 2; ++$tab)
{
$sous_categories = getSousCategories($db, $tab);
for($tab = 0; $tab < 2; ++$tab)
{
$sous_categories = getSousCategories($db, $tab);
?>
<div id="tab<?php echo $tab; ?>" class="tabContent">
<?php
for($sous_cat_it = 0; $sous_cat_it < count($sous_categories); ++$sous_cat_it)
{
$sous_cat_id = $sous_categories[$sous_cat_it]['sous_cat_id'];
$sous_cat_titre = $sous_categories[$sous_cat_it]['sous_cat_titre'];
for($sous_cat_it = 0; $sous_cat_it < count($sous_categories); ++$sous_cat_it)
{
$sous_cat_id = $sous_categories[$sous_cat_it]['sous_cat_id'];
$sous_cat_titre = $sous_categories[$sous_cat_it]['sous_cat_titre'];
?>
<h2><?php echo $sous_cat_titre;?></h2>
<?php
$categories = getCategoriesBySousCategorie($db, $sous_cat_id);
for($cat_it = 0; $cat_it < count($categories); ++$cat_it)
{
$cat_id = $categories[$cat_it]['cat_id'];
$cat_titre = $categories[$cat_it]['cat_titre'];
$categories = getCategoriesBySousCategorie($db, $sous_cat_id);
for($cat_it = 0; $cat_it < count($categories); ++$cat_it)
{
$cat_id = $categories[$cat_it]['cat_id'];
$cat_titre = $categories[$cat_it]['cat_titre'];
?>
<input type="checkbox" id="cat_<?php echo $cat_id; ?>" name="cat_<?php echo $cat_id; ?>" />
<label for="cat_<?php echo $cat_id; ?>"><span></span><?php echo $cat_titre;?></label><br />
<?php
}
}
}
?>
</div>
<?php
}
}
?>
</form>
<!--
<h2>Conférences, Évènements</h2>
<form name="confs" action="" method="POST">
<div align="left"><br>
<input type="checkbox" id="c1" name="cc" />
<label for="c1"><span></span>Biomédical</label><br>
<input type="checkbox" id="c2" name="cc" />
<label for="c2"><span></span>Domotique</label><br>
<input type="checkbox" id="c3" name="cc" />
<label for="c3"><span></span>Informatique</label><br>
<input type="checkbox" id="c4" name="cc" />
<label for="c4"><span></span>Matériaux</label><br>
<input type="checkbox" id="c5" name="cc" />
<label for="c5"><span></span>Télécommunication</label><br>
<input type="checkbox" id="c6" name="cc" />
<label for="c6"><span></span>Divers</label><br>
<br>
</div>
</form>
<h2>Clubs, associations</h2>
<form name="confs" action="" method="POST">
<div align="left"><br>
<input type="checkbox" id="c7" name="cc" />
<label for="c7"><span></span>Club Framboise</label><br>
<input type="checkbox" id="c8" name="cc" />
<label for="c8"><span></span>ESIRDuino</label><br>
<input type="checkbox" id="c9" name="cc" />
<label for="c9"><span></span>Club Tricot</label><br>
<input type="checkbox" id="c10" name="cc" />
<label for="c10"><span></span>Club Miam</label><br>
<input type="checkbox" id="c11" name="cc" />
<label for="c11"><span></span>Les lapins noirs</label><br>
<input type="checkbox" id="c12" name="cc" />
<label for="c12"><span></span>Club rigolo</label><br>
<br>
</div>
</form>-->
<a id="ancherEvent" href="#addEvent" onclick="alert('Ajoute un evenement');">
<div class="Button" id="AddEvent">
+ Ajouter un Évènement
</div>
</a>
</div>
</nav>
@ -142,63 +107,62 @@ else
<div id="calendar">
<?php
//FIXME: events are not displayed on the first day
$monthDate = strtotime('last monday +'.($weekOffset+3).' weeks');
<?php
$monthDate = strtotime('last monday +'.($weekOffset+3).' weeks');
for($week = $weekOffset; $week < $weekOffset + 5; ++$week)
{
echo('
<ul class="week">');
for($date = strtotime('last monday +'.$week.' weeks');
$date < strtotime('next monday +'.$week.' weeks');
$date = strtotime('+1 day', $date)
)
for($week = $weekOffset; $week < $weekOffset + 5; ++$week)
{
$events = getEventsByDate($db, $date);
echo('
<ul class="week">');
for($date = strtotime('last monday +'.$week.' weeks');
$date < strtotime('next monday +'.$week.' weeks');
$date = strtotime('+1 day', $date)
)
{
$events = getEventsByDate($db, $date);
$class = '';
if(date('m', $date) != date('m', $monthDate))
$class .= ' otherMonth';
$class = '';
if(date('m', $date) != date('m', $monthDate))
$class .= ' otherMonth';
if(date('Y-m-d', $date) == date('Y-m-d'))
$class .= ' today';
if(date('Y-m-d', $date) == date('Y-m-d'))
$class .= ' today';
echo('
echo('
<li class="day'.$class.'">
<a href="./day.php?date='.date('Y-m-d', $date) .'">
<h2>
<span class="minititle left">'.$days[date("N",$date)].'</span>
'.date("d", $date));
if(date('m', $date) != date('m', $monthDate))
echo('<span class="minititle right">/'.date("m",$date).'</class>');
echo('
if(date('m', $date) != date('m', $monthDate))
echo('<span class="minititle right">/'.date("m",$date).'</class>');
echo('
</h2>
</a>
<ul>');
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('
</ul>
</li>');
}
echo('
}
echo('
</ul>'."\n");
}
?>
}
?>
<div id="footer">
<div id="TextFooter">
<div id="exMois">
<a id="ancherMore" href="./index.php?w=<?php echo($weekOffset - 1); ?>"><img id="exMore" alt="expand less" src="images/expand_less.png" /></a>
<div id="Mois"><?php echo($months[date('n',$monthDate)].' '.date('Y',$monthDate)); ?></div>
<a id="ancherLess" href="./index.php?w=<?php echo($weekOffset + 1); ?>"><img id="exLess" alt="expand more" src="images/expand_more.png" /></a>
</div>
<div id="Export"><a href="./export.php?w=<?php echo($weekOffset); ?>">Exporter (iCal)</a></div>
</div>
<div>
</div>
<script src="hamburger.js"></script>
</body>
</html>
<div id="footer">
<div id="TextFooter">
<div id="exMois">
<a id="ancherMore" href="./index.php?w=<?php echo($weekOffset - 1); ?>"><img id="exMore" alt="expand less" src="images/expand_less.png" /></a>
<div id="Mois"><?php echo($months[date('n',$monthDate)].' '.date('Y',$monthDate)); ?></div>
<a id="ancherLess" href="./index.php?w=<?php echo($weekOffset + 1); ?>"><img id="exLess" alt="expand more" src="images/expand_more.png" /></a>
</div>
<div id="Export"><a href="./export.php?w=<?php echo($weekOffset); ?>">Exporter (iCal)</a></div>
</div>
<div>
</div>
<script src="hamburger.js"></script>
</body>
</html>

+ 15
- 12
populateDatabase.sql View File

@ -1,16 +1,19 @@
INSERT INTO sous_categorie(sous_cat_id, sous_cat_tab, sous_cat_titre) VALUES(0,0, "Conférences, évènements");
INSERT INTO sous_categorie(sous_cat_id, sous_cat_tab, sous_cat_titre) VALUES(1,0, "Clubs, Associations");
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[IN] Imagerie numérique", 0);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[IS] Ingénierie pour la santé", 0);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[MAT] Matériaux", 0);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[SI] Systèmes d'information", 0);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[T&R] Télécoms et réseaux", 0);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("[TICB] Domotique", 0);
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[IN] Imagerie numérique");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[IS] Ingénierie pour la santé");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[MAT] Matériaux");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[SI] Systèmes d'information");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[T&R] Télécoms et réseaux");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(0, "[TICB] Domotique");
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Isati", 1);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Club Dorothée", 1);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Club de golf", 1);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Club Maté", 1);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Club Beurre Salé", 1);
INSERT INTO categorie(cat_titre, sous_cat_id) VALUES("Association de défence des kakapos", 1);
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Isati");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Club Dorothée");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Club de golf");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Club Maté");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Club Beurre Salé");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(1, "Association de défence des kakapos");
INSERT INTO sous_categorie(sous_cat_id, sous_cat_tab, sous_cat_titre) VALUES(2,1, "Associations");
INSERT INTO categorie(sous_cat_id, cat_titre) VALUES(2, "Labfab");

Loading…
Cancel
Save