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
|
<?php require_once('inc/bdd.php');?>
<?php require_once('inc/fonctions.php');?>
<?php require_once('classes/candidats.class.php');?>
<?php require_once('classes/date.class.php');?>
<?php include('inc/header.php');?>
<?php
$date = new Date();
/* Essai en passant par la checkbox
if(isset($_POST['days'])) :
foreach ($_POST['days'] as $dateAdd => $value):
if (($date->verifEvents($dateAdd,1) != true) && ($value==true))
$date->AddEvents($dateAdd,1);
endforeach;
endif;
*/
?>
<?php
$months = array('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
$year = date('Y');
$events = $date->getEvents($year,1);
$dates = $date->getAll($year);
?>
<form method="post">
<div class="periods">
<div class="year"><?php echo $year; ?></div>
<div class="clear"></div>
<?php $dates = current($dates); ?>
<?php
$i = 0;
foreach ($dates as $m=>$days):
$i++;
?>
<div class="calendar">
<div class="month relative" id="month<?php echo $m; ?>">
<div class="months"><?php echo $months[$i-1]; ?></div>
<table>
<thead>
<tr>
<?php foreach ($date->days as $d): ?>
<th><?php echo substr($d,0,3); ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<?php $end = end($days); foreach($days as $d=>$w): ?>
<?php $time = strtotime("$year-$m-$d"); ?>
<?php if($d == 1 && $w != 1): ?>
<td colspan="<?php echo $w-1; ?>" class="padding"></td>
<?php endif; ?>
<td class="<?php if($time == strtotime(date('Y-m-d'))): echo 'today'; endif; ?><?php if(isset($events[$time])): foreach($events[$time] as $e): echo ' off'; endforeach; endif; ?>">
<div class="relative">
<div class="day"><?php echo $d; ?></div>
<div class="daycheck">
<?php if($date->verifEvents("$year-$m-$d",1) == true) : ?>
<input type="checkbox" name="days[<?php echo "$year-$m-$d" ?>]" checked="checked" />
<?php else : ?>
<input type="checkbox" name="days[<?php echo "$year-$m-$d" ?>]" />
<?php endif;?>
</div>
</div>
</td>
<?php if($w == 7): ?>
</tr><tr>
<?php endif; ?>
<?php endforeach; ?>
<?php if($end != 7): ?>
<td colspan="<?php echo 7-$end; ?>" class="padding"></td>
<?php endif; ?>
</tr>
</tbody>
</table>
</div>
</div><!--calendar -->
<?php endforeach; ?>
</div>
<div class="clear"></div>
<div><input type="submit" name="submit" value="Envoyer" /></div>
</form>
<pre><?php var_dump($_POST); ?></pre>
<?php include('inc/footer.php');?> |
Partager