| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * or see http://www.gnu.org/ 18 * 19 * $Id: modules_boxes.php,v 1.15 2005/12/03 04:05:41 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/modules_boxes.php,v $ 21 */ 22 23 /** 24 \file htdocs/includes/boxes/modules_boxes.php 25 \ingroup facture 26 \brief Fichier contenant la classe mère des boites 27 \version $Revision: 1.15 $ 28 */ 29 30 31 /** 32 \class ModeleBoxes 33 \brief Classe mère des boites 34 */ 35 36 class ModeleBoxes 37 { 38 var $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite 39 40 var $error=''; 41 42 43 /** 44 \brief Renvoi le dernier message d'erreur de création de facture 45 */ 46 function error() 47 { 48 return $this->error; 49 } 50 51 52 /** 53 \brief Methode standard d'affichage des boites 54 \param $head tableau des caractéristiques du titre 55 \param $contents tableau des lignes de contenu 56 */ 57 function showBox($head, $contents) 58 { 59 global $langs; 60 61 $bcx[0] = 'class="box_pair"'; 62 $bcx[1] = 'class="box_impair"'; 63 64 $var = true; 65 $nbcol=sizeof($contents[0])+1; 66 $nblines=sizeof($contents); 67 68 print '<table width="100%" class="noborder">'; 69 70 // Affiche titre de la boite 71 print '<tr class="box_titre"><td'; 72 if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; } 73 print '>'.$head['text']; 74 if ($head['sublink']) 75 { 76 print ' <a href="'.$head['sublink'].'">'.img_picto($head['subtext'],$head['subpicto']).'</a>'; 77 } 78 print '</td></tr>'; 79 80 // Affiche chaque ligne de la boite 81 for ($i=0, $n=$nblines; $i < $n; $i++) 82 { 83 if (isset($contents[$i])) 84 { 85 $var=!$var; 86 if (sizeof($contents[$i])) 87 { 88 if (isset($contents[$i][-1]['class'])) print '<tr valign="top" class="'.$contents[$i][-1]['class'].'">'; 89 else print '<tr valign="top" '.$bcx[$var].'>'; 90 } 91 92 // Affiche chaque cellule 93 for ($j=0, $m=sizeof($contents[$i]); $j < $m; $j++) 94 { 95 $tdparam=""; 96 if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"'; 97 if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"'; 98 if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"'; 99 if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"'; 100 101 if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']=""; 102 $texte=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; 103 $textewithnotags=eregi_replace('<[^>]+>','',$texte); 104 $texte2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; 105 $texte2withnotags=eregi_replace('<[^>]+>','',$texte2); 106 //print "xxx $textewithnotags y"; 107 108 if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) print '<td width="16">'; 109 else print '<td '.$tdparam.'>'; 110 111 if (isset($contents[$i][$j]['url'])) print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'">'; 112 if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) 113 { 114 $logo=eregi_replace("^object_","",$contents[$i][$j]['logo']); 115 print img_object($langs->trans("Show"),$logo); 116 if (isset($contents[$i][$j]['url'])) print '</a>'; 117 print '</td><td '.$tdparam.'>'; 118 if (isset($contents[$i][$j]['url'])) 119 { 120 print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"'; 121 //print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>" 122 print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; 123 print '>'; 124 } 125 } 126 $maxlength=$this->MAXLENGTHBOX; 127 if (isset($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; 128 129 if ($maxlength && strlen($textewithnotags) > $maxlength) 130 { 131 $texte=substr($texte,0,$maxlength)."..."; 132 } 133 if ($maxlength && strlen($texte2withnotags) > $maxlength) 134 { 135 $texte2=substr($texte2,0,$maxlength)."..."; 136 } 137 print $texte; 138 if (isset($contents[$i][$j]['url'])) print '</a>'; 139 print $texte2; 140 print "</td>"; 141 } 142 143 if (sizeof($contents[$i])) print '</tr>'; 144 } 145 } 146 147 print "</table>"; 148 } 149 150 } 151 152 153 ?>
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 |
|