static function prettyFormat($date, $format = '{day} {dd} {month} {yyyy}', $empty = 'indéfinie') { if (!($time = strtotime($date))) { return $empty; } $after = strtotime("+7 day 00:00"); $afterTomorrow = strtotime("+2 day 00:00"); $tomorrow = strtotime("+1 day 00:00"); $today = strtotime("today 00:00"); $yesterday = strtotime("-1 day 00:00"); $beforeYesterday = strtotime("-2 day 00:00"); $before = strtotime("-7 day 00:00"); if ($time < $after && $time > $before) { if ($time >= $after) { $relative = strftime("%A", $date) . " prochain"; } else { if ($time >= $afterTomorrow) { $relative = "après demain"; } else { if ($time >= $tomorrow) { $relative = "demain"; } else { if ($time >= $today) { $relative = "aujourd'hui"; } else { if ($time >= $yesterday) { $relative = "hier"; } else { if ($time >= $beforeYesterday) { $relative = "avant hier"; } else { if ($time >= $before) { $relative = strftime("%A", $time) . " dernier"; } } } } } } } if (preg_match('/[0-2][0-9]:[0-5][0-9]/', $date)) { $relative .= ' à ' . date('H:i', $time); } } else { $relative = 'le ' . DateHelper::format($format); } return $relative; }
echo ++$i % 2 ? 'odd' : 'even'; ?> "> <th scope="row">Type</th> <td><?php echo $Picture['type']; ?> </td> </tr> <tr class="<?php echo ++$i % 2 ? 'odd' : 'even'; ?> "> <th scope="row">Mise en ligne</th> <td><?php echo DateHelper::format($Picture['created_at']); ?> </td> </tr> </tbody> </table> <ul class="actions"> <li><a class="sprite left prefix edit" title="Editer" href="<?php echo UrlHelper::path(array('action' => 'edit'), $Picture['id']); ?> ">Editer</a></li> <li><a class="sprite left prefix delete" title="Supprimer" href="<?php echo UrlHelper::path(array('action' => 'delete'), $Picture['id']); ?> ">Supprimer</a></li>
?> </a></strong><br> <?php echo $Picture['width']; ?> x <?php echo $Picture['height']; ?> pixels<br> <?php echo ucfirst($Picture['type']); ?> <br> </td> <td><?php echo DateHelper::format($Picture['created_at'], '{dd} {month} {yy} à {HH}:{MM}'); ?> </td> <td> <ul class="actions"> <li><a class="sprite prefix edit insert" title="Insertion" href="<?php echo UrlHelper::path(array('action' => 'insertionEdit'), $Picture['id']); ?> ">Insérer</a></li> </ul> </td> </tr> <? endforeach ?> <? if (!count($Pictures)) : ?> <tr class="empty <?php