comparison includes/class.post.php @ 33:c6508503269a

Possibilité d'avoir les dates en ISO 8601, requis par Atom.
author Franck Deroche <webmaster@defr.org>
date Mon, 05 Nov 2007 09:23:40 +0100
parents 4cea8b128fdd
children ec0c926a78a6
comparison
equal deleted inserted replaced
32:4cea8b128fdd 33:c6508503269a
1 <?php 1 <?php
2 class Post { 2 class Post {
3 private $tpl; 3 private $tpl;
4 private $infos; 4 private $infos;
5 private $mess; 5 private $mess;
6 private $dateFormatee; 6 private $dateFormatee = array();
7 private $url; 7 private $url;
8 private $commentLabel; 8 private $commentLabel;
9 private $mood; 9 private $mood;
10 private $tags; 10 private $tags;
11 11
23 $this->mess = $this->tpl->getDocumentFragment(); 23 $this->mess = $this->tpl->getDocumentFragment();
24 $this->mess->appendXML($Mess); 24 $this->mess->appendXML($Mess);
25 25
26 // Formatage de la date 26 // Formatage de la date
27 $time = strtotime($infos['DatePost']); 27 $time = strtotime($infos['DatePost']);
28 $this->dateFormatee = strftime("%A %d %B %Y, %Hh%M", $time); 28 $this->dateFormatee['human'] = strftime("%A %d %B %Y, %Hh%M", $time);
29 $this->dateFormatee['iso'] = date("c", $time);
29 30
30 // On détermine l'url de ce post 31 // On détermine l'url de ce post
31 $strippedTitle = TextUtils::StripTitle($infos['Titre']); 32 $strippedTitle = TextUtils::StripTitle($infos['Titre']);
32 $this->url = '/blog/posts/' . $infos['num_mess'] . '-' . $strippedTitle; 33 $this->url = '/blog/posts/' . $infos['num_mess'] . '-' . $strippedTitle;
33 34
72 73
73 public function getTplParams() { 74 public function getTplParams() {
74 $params = array( 75 $params = array(
75 '#post@class' => 'PostContent ' . $this->infos->Emot, 76 '#post@class' => 'PostContent ' . $this->infos->Emot,
76 'postTitle' => $this->infos->Titre, 77 'postTitle' => $this->infos->Titre,
77 'postDate' => $this->dateFormatee, 78 'postDate' => $this->dateFormatee['human'],
79 'postDateISO' => $this->dateFormatee['iso'],
78 'postContent' => $this->mess, 80 'postContent' => $this->mess,
79 'postNumber' => $this->infos->num_mess, 81 'postNumber' => $this->infos->num_mess,
80 'postComments' => $this->commentLabel, 82 'postComments' => $this->commentLabel,
81 '#linkPostNumber@href' => $this->url, 83 '#linkPostNumber@href' => $this->url,
82 '#linkPostComments@href' => $this->url, 84 '#linkPostComments@href' => $this->url,