<?php
#=
/****************************************************************************
Copyright 2002, Daniel Deycard, Jacques Messines, Stéphanie Roussel, Jean-Marie Treins
(CATICE Académie de Bordeaux)

This file is part of Gibii.

Gibii is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Gibii is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Gibii; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

****************************************************************************/

class htmlcreator {
    var $classtr,$styletr,
        $classtd,$styletd,
        $classth,$styleth;

    function htmlcreator() {
        $this->styletd="";$this->styleth="";
        $this->classtd="";$this->classth="";
    }
    function begintable($param="width=\"100%\"") {
        print "<table $param>\n";
    }
    function endtable() {
        print "</table>\n";
    }
    function beginrow($param="") {
        if ($param) $plus=$param;
        elseif ($this->classtr) $plus="class=\"$this->classtr\"";
        elseif ($this->styletr) $plus="style=\"$this->styletr\"";
        else $plus='';
        print "\t<tr $plus>\n";
    }
    function endrow() {
        print "\t</tr>\n";
    }
    function entetes() {
        //première ligne d'un tableau html (nb paramètres (colonnes) variable)
        for ($i=0;$i<func_num_args();$i++) {
             if ($this->classth) $plus="class=\"$this->classth\"";
             elseif ($this->styleth) $plus=$this->styleth;
             else $plus="";
             print "\t<th $plus>".func_get_arg($i)."</th>\n";
        }
    }
    function colonnes() {
        //affiche une ligne d'un tableau (nb cellules variable)
        for ($i=0;$i<func_num_args();$i++) {
             if ($this->classtd) $plus="class=\"$this->classtd\"";
             elseif ($this->styletd) $plus=$this->styletd;
             else $plus="";
             print "\t\t<td $plus>".func_get_arg($i)."</td>\n";
        }
    }
    function colonne($valeur,$param="") { //affiche une seule cellule
        if ($param) $plus=$param;
        elseif ($this->classtd) $plus="class=\"$this->classtd\"";
        elseif ($this->styletd) $plus=$this->styletd;
        else $plus="";
        print "\t\t<td $plus>$valeur</td>\n";
    }
}
?>
