New: Personalisation des boxes par un picto.

This commit is contained in:
Laurent Destailleur
2005-02-01 17:55:16 +00:00
parent 86ff67819d
commit fad86554d2
4 changed files with 54 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,16 +21,16 @@
*
*/
/*! \file htdocs/boxes.php
\brief Fichier de la classe boxes
\author Rodolphe Qiedeville
\author Laurent Destailleur
\version $Revision$
/** \file htdocs/boxes.php
\brief Fichier de la classe boxes
\author Rodolphe Qiedeville
\author Laurent Destailleur
\version $Revision$
*/
/*! \class infoBox
/** \class infoBox
\brief Classe permettant la gestion des boxes sur une page
\remarks Cette classe est utilis<69> par les fichiers includes/boxes/box_xxx.php
\remarks qui sont les modules de boites
@@ -39,51 +39,60 @@
class infoBox
{
/*!
/**
* \brief Constructeur de la classe
* \param $head tableau des entetes de colonnes
* \param $contents tableau des lignes
*/
function infoBox($head, $contents)
{
global $langs;
$MAXLENGTHBOX=70; // Mettre 0 pour pas de limite
$var = true;
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
$nbcol=sizeof($contents[0]);
$nbcol=sizeof($contents[0])+1;
print '<table width="100%" cellpadding="2" cellspacing="0" class="noborder">';
print '<table width="100%" class="noborder">';
// Affiche titre de la boite
print '<tr class="box_titre"><td';
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
print '>'.$head[0]['text']."</td></tr>";
for ($i=0, $n=sizeof($contents); $i<$n; $i++)
// Affiche chaque ligne de la boite
for ($i=0, $n=sizeof($contents); $i < $n; $i++)
{
$var=!$var;
print '<tr valign="top" '.$bcx[$var].'>';
for ($j=0, $m=sizeof($contents[$i]); $j<$m; $j++)
// Affiche chaque cellule
for ($j=0, $m=sizeof($contents[$i]); $j < $m; $j++)
{
print "<td";
if (strlen($contents[$i][$j]['align']) > 0)
{
print ' align="'. $contents[$i][$j]['align'].'"';
}
if (strlen($contents[$i][$j]['width']) > 0)
{
print ' width="'. $contents[$i][$j]['width'].'"';
}
print'>';
$tdparam="";
if ($contents[$i][$j]['align']) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
if ($contents[$i][$j]['width']) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
if (strlen($contents[$i][$j]['url']) > 0)
{
print '<a href="'.$contents[$i][$j]['url'].'">';
print $contents[$i][$j]['text'] . "</a></td>";
}
else
{
print $contents[$i][$j]['text'] . "</td>";
}
if ($contents[$i][$j]['logo']) print '<td width="16">';
else print '<td '.$tdparam.'>';
if ($contents[$i][$j]['url']) print '<a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
if ($contents[$i][$j]['logo']) {
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
print img_object($langs->trans("Show"),$logo);
print '</a></td><td '.$tdparam.'><a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
}
$texte=$contents[$i][$j]['text'];
if ($MAXLENGTHBOX && strlen($texte) > $MAXLENGTHBOX)
{
$texte=substr($texte,0,$MAXLENGTHBOX)."...";
}
print $texte;
if ($contents[$i][$j]['url']) print '</a>';
print "</td>";
}
print '</tr>';
}