function add_event_date_info($events) { $eclasses = array(); $ecc = 0; foreach ($events as $ekey => $eve) { $title = trim($eve['title']); if (strpos($title, 'Equipping Class') !== false) { $date = datesimple($eve['ending_at']); $eclasses[$title][] = array('date' => $date, 'ekey' => $ekey); } // end if } // end foreach // go thru new array and find first and last foreach ($eclasses as $dkey => $dates) { end($dates); // move the internal pointer to the end of the array $endkey = key($dates); $days = ''; foreach ($dates as $key => $date) { $lastmonth = isset($month) && !empty($month) ? $month : ''; $month = date('M', strtotime($date['date'])); $day = date('d', strtotime($date['date'])); if ($key == 0) { $startmonth = $month; } elseif ($key == $endkey) { $endmonth = $month; } if ($month != $lastmonth) { $days .= $month . ' '; } $days .= $day; if ($key != $endkey) { $days .= ', '; // unset all event records of this name except the last one unset($events[$date['ekey']]); } else { $days .= ' '; $mykey = $date['ekey']; } } // end foreach if ($startmonth == $endmonth) { $months = $startmonth; } else { $months = $startmonth . ' / ' . $endmonth; } $dateinfo = array('name' => $dkey, 'month' => $months, 'days' => $days); $events[$mykey]['dateinfo'] = $dateinfo; } // end foreach // print_r('<pre style="padding: 10px; border: 1px solid #000; font-size: 11px; margin: 10px">'); print_r( $events ); print_r('</pre>'); return $events; }
<p><strong>Numéro d'evenement : </strong><?php echo $ligne2['code_even']; ?> <br><br></p> <p><strong>Résponsable : </strong><?php echo $ligne2['responsable']; ?> <br><br></p> <p><strong>Date de decision : </strong><?php echo datesimple($ligne2['datedecis']); ?> <br><br></p> <p><strong>Date de réalisation : </strong><?php echo datesimple($ligne2['daterealis']); ?> <br><br></p> <p><strong>Fichiers joints : </strong><?php $fich = false; $select3 = 'SELECT nomdoc,chemindoc FROM documents_evenement where documents_evenement.ide=' . $id_even; $result3 = mysql_query($select3); $chem = ''; $name = 'aucun fichier trouvé'; while ($ligne3 = mysql_fetch_array($result3)) { $fich = true; ?> <a href="<?php echo $ligne3['chemindoc']; ?>
<div class="chat-time"> <i class="glyph-icon icon-clock-o"></i> <?php echo temps_qui_reste($ligne['dateecheance'], "date"); ?> </div> </div> </div> <div class="tl-panel"> <?php echo datesimple($ligne['datedecision']); ?> </div> </div> <?php } } else { echo "<h4 align='center' > Rien A Signaler</h4>"; } ?> </div>