[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Éric Seigne <erics@rycks.com> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: box_external_rss.php,v 1.10 2005/09/06 00:29:39 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_external_rss.php,v $ 22 */ 23 24 /** 25 \file htdocs/includes/boxes/box_external_rss.php 26 \ingroup external_rss 27 \brief Fichier de gestion d'une box pour le module external_rss 28 \version $Revision: 1.10 $ 29 */ 30 31 include_once(MAGPIERSS_PATH."rss_fetch.inc"); 32 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 33 34 35 class box_external_rss extends ModeleBoxes { 36 37 var $boxcode="lastrssinfos"; 38 var $boximg="object_rss"; 39 var $boxlabel; 40 var $depends = array(); 41 42 var $info_box_head = array(); 43 var $info_box_contents = array(); 44 45 /** 46 * \brief Constructeur de la classe 47 */ 48 function box_external_rss() 49 { 50 global $langs; 51 $langs->load("boxes"); 52 53 $this->boxlabel=$langs->trans("BoxLastRssInfos"); 54 } 55 56 /** 57 * \brief Charge les données en mémoire pour affichage ultérieur 58 * \param $max Nombre maximum d'enregistrements à charger 59 */ 60 function loadBox($max=5) 61 { 62 global $user, $langs, $db; 63 $langs->load("boxes"); 64 65 for($site = 0; $site < 1; $site++) { 66 $rss = fetch_rss( @constant("EXTERNAL_RSS_URLRSS_" . $site) ); 67 68 $title=$langs->trans("BoxTitleLastRssInfos",$max, @constant("EXTERNAL_RSS_TITLE_". $site)); 69 if ($rss->ERROR) { 70 // Affiche warning car il y a eu une erreur 71 $title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date'))); 72 $this->info_box_head = array('text' => $title); 73 } 74 75 $this->info_box_head = array('text' => $title); 76 77 for($i = 0; $i < $max ; $i++){ 78 $item = $rss->items[$i]; 79 $href = $item['link']; 80 $title = utf8_decode(urldecode($item['title'])); 81 $title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8 82 $title=ereg_replace("^\s+","",$title); // Supprime espaces de début 83 $this->info_box_contents["$href"]="$title"; 84 $this->info_box_contents[$i][0] = array('align' => 'left', 85 'logo' => $this->boximg, 86 'text' => $title, 87 'url' => $href, 88 'target' => 'newrss'); 89 } 90 91 92 } 93 } 94 95 function showBox() 96 { 97 parent::showBox($this->info_box_head, $this->info_box_contents); 98 } 99 100 } 101 102 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |