19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: bazar.fonct.formulaire.php,v 1.20 2006-04-28 12:46:14 florian Exp $ |
// CVS : $Id: bazar.fonct.formulaire.php,v 1.21 2006-05-19 13:54:11 florian Exp $ |
/** |
* Formulaire |
* |
31,7 → 31,7 |
//Autres auteurs : |
*@author Aleandre GRANIER <alexandre@tela-botanica.org> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.20 $ $Date: 2006-04-28 12:46:14 $ |
*@version $Revision: 1.21 $ $Date: 2006-05-19 13:54:11 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
49,14 → 49,21 |
* @param string valeur par défaut du formulaire |
* @param string table source pour les valeurs de la liste |
* @param string ce champs est il obligatoire? (required) |
* @param boolean sommes nous dans le moteur de recherche? |
* @return void |
*/ |
function liste(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function liste(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"'; |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ; |
if (DB::isError ($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
if ($dans_moteur_de_recherche==0) { |
$select[0]=BAZ_CHOISIR; |
} |
else { |
$select[0]=BAZ_INDIFFERENT; |
} |
while ($ligne = $resultat->fetchRow()) { |
$select[$ligne[1]] = $ligne[2] ; |
} |
67,7 → 74,7 |
$select->setMultiple(0); |
$select->setSelected($defaut); |
$formtemplate->addElement($select) ; |
if (isset($obligatoire)and($obligatoire==1)) { |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.$label , 'nonzero', '', 'client') ; |
$formtemplate->addRule('liste'.$id_liste, $label.' obligatoire', 'required', '', 'client') ;} |
} |
85,7 → 92,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function checkbox(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function checkbox(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'" ORDER BY blv_label'; |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ; |
if (DB::isError ($resultat)) { |
110,7 → 117,7 |
$squelette_checkbox->setGroupElementTemplate( "\n".'<div class="bazar_checkbox">'."\n".'{element}'."\n".'</div>'."\n", 'checkbox'.$id_liste); |
|
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, $label, "\n"); |
if (isset($obligatoire)and($obligatoire==1)) { |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addGroupRule('checkbox'.$id_liste, $label.' obligatoire', 'required', null, 1, 'client'); |
} |
} |
128,7 → 135,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function listedatedeb(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function listedatedeb(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
$optiondate = array('language' => BAZ_LANGUE_PAR_DEFAUT, |
'minYear' => date('Y'), |
'maxYear'=> (date('Y')+10), |
143,7 → 150,9 |
$formtemplate->setDefaults($defauts); |
} |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ; |
} |
} |
|
/** listedatefin() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de fin |
158,8 → 167,8 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function listedatefin(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
listedatedeb($formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire); |
function listedatefin(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
listedatedeb($formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche); |
} |
|
|
175,7 → 184,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function texte(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function texte(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
$option=array('size'=>$limite1,'maxlength'=>$limite2); |
$formtemplate->addElement('text', $nom_bdd, $label, $option) ; |
//gestion des valeurs par défaut |
183,7 → 192,9 |
$formtemplate->setDefaults($defauts); |
$formtemplate->applyFilter($nom_bdd, 'addslashes') ; |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ; |
} |
} |
|
|
199,7 → 210,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
$formtexte= new HTML_QuickForm_textarea($nom_bdd, $label, array('style'=>'white-space: normal;')); |
$formtexte->setCols($limite1); |
$formtexte->setRows($limite2); |
209,7 → 220,9 |
$formtemplate->setDefaults($defauts); |
$formtemplate->applyFilter($nom_bdd, 'addslashes') ; |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ; |
} |
} |
|
/** url() - Ajoute un élément de type url internet au formulaire |
224,7 → 237,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function url(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function url(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
//recherche des URLs deja entrees dans la base |
$html_url= ''; |
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) { |
264,7 → 277,7 |
$formtemplate->addElement('text', 'url_lien'.$nom_bdd, BAZ_URL_LIEN) ; |
$formtemplate->addElement('text', 'url_texte'.$nom_bdd, BAZ_URL_TEXTE) ; |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) { |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule('url_lien'.$nom_bdd, BAZ_URL_LIEN_REQUIS, 'required', '', 'client') ; |
$formtemplate->addRule('url_texte'.$nom_bdd, BAZ_URL_TEXTE_REQUIS, 'required', '', 'client') ; |
} |
282,7 → 295,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function fichier(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function fichier(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
//AJOUTER DES FICHIERS JOINTS |
$html_fichier= ''; |
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) { |
323,7 → 336,7 |
$formtemplate->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image |
$formtemplate->setMaxFileSize($limite1); |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) { |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule('texte_fichier'.$nom_bdd, BAZ_FICHIER_LABEL_REQUIS, 'required', '', 'client') ; |
$formtemplate->addRule('fichier'.$nom_bdd, BAZ_FICHIER_JOINT_REQUIS, 'required', '', 'client') ; |
} |
341,7 → 354,7 |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function image(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function image(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
//AJOUTER UNE IMAGE |
$html_image= ''; |
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) { |
375,13 → 388,27 |
//TODO: controler si c'est une image |
$formtemplate->setMaxFileSize($limite1); |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) { |
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) { |
$formtemplate->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, 'required', '', 'client') ; |
} |
} |
|
/** wikini() - Ajoute un wikini au formulaire |
* |
* @param mixed L'objet QuickForm du formulaire |
* @param string numero du champs input du formulaire (pour le différencier d'autres champs du meme type dans ce formulaire) |
* @param string label à afficher dans le formulaire |
* @param string taille maximum du fichier colonnes de l'élément |
* @param string taille des lignes de l'élément |
* @param string valeur par défaut du formulaire |
* @param string table source pour les valeurs du texte (inutile) |
* @param string ce champs est il obligatoire? (required) |
* @return void |
*/ |
function wikini(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
|
} |
|
|
/** labelhtml() - Ajoute un élément de type textearea au formulaire |
* |
* @param mixed L'objet QuickForm du formulaire |
394,9 → 421,9 |
* @param string ce champs est il obligatoire? (required) (pas utilisé) |
* @return void |
*/ |
function labelhtml(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
function labelhtml(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) { |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php'; |
$formhtml= new HTML_QuickForm_html('<tr>'."\n".'<td colspan="2">'."\n".$label."\n".'</td>'."\n".'</tr>'."\n"); |
$formhtml= new HTML_QuickForm_html('<tr>'."\n".'<td colspan="2" style="text-align:left;">'."\n".$label."\n".'</td>'."\n".'</tr>'."\n"); |
$formtemplate->addElement($formhtml) ; |
} |
|
403,6 → 430,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.20 2006/04/28 12:46:14 florian |
* integration des liens vers annuaire |
* |
* Revision 1.19 2006/03/02 20:36:52 florian |
* les entrees du formulaire de saisir ne sont plus dans les constantes mias dans des tables qui gerent le multilinguisme. |
* |