Line 203... |
Line 203... |
203 |
private function ajouterCommentaire($station, $source, & $maille) {
|
203 |
private function ajouterCommentaire($station, $source, & $maille) {
|
204 |
$commentaires = array();
|
204 |
$commentaires = array();
|
205 |
if ($maille->hasAttribute('title')) {
|
205 |
if ($maille->hasAttribute('title')) {
|
206 |
$commentaires = explode("; ", $maille->attributes->getNamedItem('title')->value);
|
206 |
$commentaires = explode("; ", $maille->attributes->getNamedItem('title')->value);
|
207 |
}
|
207 |
}
|
- |
|
208 |
|
208 |
$commentaire = ucfirst($source)." : {$station['commune']}, ";
|
209 |
$commentaire = ucfirst($source)." : {$station['commune']}, ";
|
209 |
if (strlen($station['date']) == 4) {
|
210 |
if (strlen($station['date']) == 4) {
|
210 |
$commentaire .= "en {$station['date']} par {$station['auteur']}";
|
211 |
$commentaire .= "en {$station['date']} par {$station['auteur']}";
|
211 |
} else {
|
212 |
} else {
|
212 |
$date = preg_replace("/(\d{4})-(\d{2})-(\d{2})/", "$3/$2/$1", $station['date']);
|
213 |
$date = preg_replace("/(\d{4})-(\d{2})-(\d{2})/", "$3/$2/$1", $station['date']);
|
213 |
$commentaire .= "le {$date} par {$station['auteur']}";
|
214 |
$commentaire .= "le {$date} par {$station['auteur']}";
|
214 |
}
|
215 |
}
|
215 |
$commentaires[] = trim($commentaire);//print_r($commentaires);echo "<br /><br />";
|
216 |
$commentaires[] = trim($commentaire);//print_r($commentaires);echo "<br /><br />";
|
216 |
$test = $this->documentXML->createElement('title', implode('; ', $commentaires));
|
217 |
$titre = $this->documentXML->createElement('title', implode('; ', $commentaires));
|
- |
|
218 |
if ($maille->hasChildNodes() && $maille->childNodes->length > 1) {
|
- |
|
219 |
$maille->replaceChild($titre, $maille->childNodes->item(1)); //print_r($maille->childNodes->item(1));echo "<br /><br />";
|
- |
|
220 |
} else {
|
217 |
$maille->appendChild($test);
|
221 |
$maille->appendChild($titre);
|
- |
|
222 |
}
|
218 |
$maille->setAttribute('title', implode('; ', $commentaires));
|
223 |
$maille->setAttribute('title', implode('; ', $commentaires));
|
219 |
}
|
224 |
}
|