diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 2bc1de7ccf3..534cad57bf0 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1,5 +1,5 @@ +/* Copyright (c) 2002-2005 Rodolphe Quiedeville * Copyright (C) 2004 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien Di Cintio @@ -23,14 +23,16 @@ * $Source$ */ -/*! \file htdocs/html.form.class.php - \brief Fichier de la classe des fonctions prédéfinie de composants html - \version $Revision$ +/*! + \file htdocs/html.form.class.php + \brief Fichier de la classe des fonctions prédéfinie de composants html + \version $Revision$ */ -/*! \class Form - \brief Classe permettant la génération de composants html +/*! + \class Form + \brief Classe permettant la génération de composants html */ class Form @@ -39,7 +41,7 @@ class Form var $errorstr; /*! \brief Constructeur - \param DB handler d'accès base de donnée + \param DB handler d'accès base de donnée */ function Form($DB) @@ -71,47 +73,47 @@ class Form $sql .= "ORDER BY code_pays, code ASC"; if ($this->db->query($sql)) - { + { print ''; - } + } else { - dolibarr_print_error($this->db); + dolibarr_print_error($this->db); } - } + } /* * \brief Retourne la liste déroulante des regions actives dont le pays est actif @@ -131,7 +133,7 @@ class Form if ($this->db->query($sql)) { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -162,7 +164,7 @@ class Form $i++; } } - print ''; + print ''; } else { dolibarr_print_error($this->db); @@ -186,38 +188,38 @@ class Form $sql .= " ORDER BY code ASC;"; if ($this->db->query($sql)) - { + { print ''; return 0; - } + } else { - dolibarr_print_error($this->db); - return 1; + dolibarr_print_error($this->db); + return 1; } } @@ -234,23 +236,23 @@ class Form $langs_available=$langs->get_available_languages(); print ''; } @@ -269,7 +271,7 @@ class Form if ($this->db->query($sql)) { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -277,18 +279,18 @@ class Form while ($i < $num) { $obj = $this->db->fetch_object(); - if ($selected > 0 && $selected == $obj->idp) - { - print ''; - } - else - { - print ''; - } + if ($selected > 0 && $selected == $obj->idp) + { + print ''; + } + else + { + print ''; + } $i++; } } - print ''; + print ''; } else { dolibarr_print_error($this->db); @@ -310,33 +312,34 @@ class Form if ($this->db->query($sql)) { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) { while ($i < $num) { - $obj = $this->db->fetch_object(); + $obj = $this->db->fetch_object(); - if ($selected && $selected == $obj->idp) - { - print ''; - } - else - { - print ''; - } + if ($selected && $selected == $obj->idp) + { + print ''; + } + else + { + print ''; + } $i++; } } - print ''; + print ''; + } + else + { + dolibarr_print_error($this->db); } - else { - dolibarr_print_error($this->db); - } } - + /* * \brief Retourne le nom d'un pays @@ -366,8 +369,6 @@ class Form } - - /* * \brief Retourne la liste déroulante des civilite actives * \param selected civilite pré-sélectionnée @@ -382,34 +383,34 @@ class Form $sql .= " WHERE active = 1"; if ($this->db->query($sql)) - { + { print ''; - } + } else { - dolibarr_print_error($this->db); + dolibarr_print_error($this->db); } } @@ -430,45 +431,45 @@ class Form $sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC"; if ($this->db->query($sql)) - { + { print ''; - } + } else { - dolibarr_print_error($this->db); + dolibarr_print_error($this->db); } } @@ -507,9 +508,9 @@ class Form function select_tva($name='', $defaulttx = '') { if (! strlen(trim($name))) - { - $name = "tauxtva"; - } + { + $name = "tauxtva"; + } $file = DOL_DOCUMENT_ROOT . "/conf/tva.local.php"; if (is_readable($file)) @@ -559,7 +560,7 @@ class Form { if (! $set_time && ! $empty) { - $set_time = time(); + $set_time = time(); } $strmonth[1] = "Janvier"; @@ -577,20 +578,20 @@ class Form // Analyse de la date de préselection if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?',$set_time,$reg)) { - // Date au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS' - $syear = $reg[1]; - $smonth = $reg[2]; - $sday = $reg[3]; - $shour = $reg[4]; - $smin = $reg[5]; + // Date au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS' + $syear = $reg[1]; + $smonth = $reg[2]; + $sday = $reg[3]; + $shour = $reg[4]; + $smin = $reg[5]; } else { - // Date est un timestamps - $syear = date("Y", $set_time); - $smonth = date("n", $set_time); - $sday = date("d", $set_time); - $shour = date("H", $set_time); - $smin = date("i", $set_time); + // Date est un timestamps + $syear = date("Y", $set_time); + $smonth = date("n", $set_time); + $sday = date("d", $set_time); + $shour = date("H", $set_time); + $smin = date("i", $set_time); } print '"; - print ''; + print '"; - } - else - { - print $this->db->error(); - } + print ""; + } + else + { + print $this->db->error(); + } - } + } - /*! - \brief Affiche un select à partir d'un tableau - \param name nom de la zone select - \param array tableau de key+valeur - \param id key présélectionnée - \param empty 1 si il faut un valeur " " dans la liste, 0 sinon - \param key_libelle 1 pour afficher la key dans la valeur "[key] value" - */ + /*! + \brief Affiche un select à partir d'un tableau + \param name nom de la zone select + \param array tableau de key+valeur + \param id key présélectionnée + \param empty 1 si il faut un valeur " " dans la liste, 0 sinon + \param key_libelle 1 pour afficher la key dans la valeur "[key] value" + */ function select_array($name, $array, $id='', $empty=0, $key_libelle=0) - { - print ''; - $i = 0; + $i = 0; - if (strlen($id)) { - if ($empty == 1) - { - $array[0] = " "; - } - reset($array); - } - - while (list($key, $value) = each ($array)) - { - print "\n"; - } - else - { - if ($value=="-") { $value=" "; } - print ">$value\n"; - } - } - - print ""; + if (strlen($id)) { + if ($empty == 1) + { + $array[0] = " "; + } + reset($array); } + + while (list($key, $value) = each ($array)) + { + print "\n"; + } + else + { + if ($value=="-") { $value=" "; } + print ">$value\n"; + } + } + + print ""; + } /* * \brief Renvoie la chaîne de caractère décrivant l'erreur * */ function error() - { - return $this->errorstr; - } + { + return $this->errorstr; + } /* @@ -864,13 +864,13 @@ class Form * */ function checkbox($name,$checked=0,$value=1) - { - if ($checked==1){ - print "\n"; - }else{ - print "\n"; - } + { + if ($checked==1){ + print "\n"; + }else{ + print "\n"; } + } /* * \brief Affiche la partie de formulaire pour saisie d'un mail @@ -883,41 +883,42 @@ class Form $langs->load("other"); - print ""; + print "
"; - // Topic - if ($withtopic) { - print ""; - print ""; - print ""; - } + // Topic + if ($withtopic) + { + print ""; + print ""; + print ""; + } // Message - if ($withbody) { - print ""; - print ""; - print ""; - } + if ($withbody) + { + print ""; + print ""; + print ""; + } - // Si fichier joint - if ($withfile) { - print ""; - print ""; - print ""; - } + // Si fichier joint + if ($withfile) + { + print ""; + print ""; + print ""; + } print "
".$langs->trans("MailTopic").""; - print ""; - print "
".$langs->trans("MailTopic").""; + print ""; + print "
".$langs->trans("MailText").""; - print ""; - print "
".$langs->trans("MailText").""; + print ""; + print "
".$langs->trans("MailFile").""; - print "trans("Upload")."\"/>"; - print "
".$langs->trans("MailFile").""; + print "trans("Upload")."\"/>"; + print "
"; - } - } ?>