58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
Class Zend_View_Helper_News extends Zend_View_Helper_Abstract
|
|
{
|
|
protected $jours = array('Mon,' => 'Lundi',
|
|
'Tue,' => 'Mardi',
|
|
'Wed,' => 'Mercredi',
|
|
'Thu,' => 'Jeudi',
|
|
'Fri,' => 'Vendredi',
|
|
'Sat,' => 'Samedi',
|
|
'Sun,' => 'Dimanche'
|
|
);
|
|
protected $mois = array ('Jan' => 'Janvier',
|
|
'Feb' => 'Février',
|
|
'Mar' => 'Mars',
|
|
'Apr' => 'Avril',
|
|
'May' => 'Mai',
|
|
'Jun' => 'Juin',
|
|
'Jul' => 'Juillet',
|
|
'Aug' => 'Aout',
|
|
'Sep' => 'Septembre',
|
|
'Oct' => 'Octobre',
|
|
'Nov' => 'Novembre',
|
|
'Dev' => 'Décembre'
|
|
);
|
|
|
|
private function returnNumberMonth($moisRecherche) {
|
|
$i = 0;
|
|
foreach($this->mois as $mois => $valeur) {
|
|
if (($i + 1) == $moisRecherche) {
|
|
return ($mois);
|
|
}
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
public function News($date)
|
|
{
|
|
$elementDate = explode(' ',$date);
|
|
$today = explode('/', date('d/m/Y'));
|
|
|
|
if ((self::returnNumberMonth($today[1]) == $elementDate[2]) and $today[0] == $elementDate[1])
|
|
return ("Aujourd'hui");
|
|
|
|
$dateFormate = '';
|
|
|
|
|
|
foreach ($this->jours as $jour => $valeurFR) {
|
|
if ($jour == $elementDate[0])
|
|
$dateFormate = $valeurFR;
|
|
}
|
|
$dateFormate .= ' '.$elementDate[1].' ';
|
|
foreach ($this->mois as $mois => $valeurFR) {
|
|
if ($mois == $elementDate[2])
|
|
$dateFormate .= $valeurFR;
|
|
}
|
|
return ($dateFormate .= ' '.$elementDate[3]);
|
|
}
|
|
} |