function formulaire($action, $ligne) { // print_r ($ligne); echo "<p>"; // Cr�ation de l'objet formulaire $form = new Formulaire("post", $this->nomScript, false); $form->setTitle($this->title); foreach ($this->hidden_fields as $nom => $value) { $form->champCache($nom, $value); } $form->champCache("ihm_action", $action); $form->debutTable(VERTICAL, array(), $nbLignes = 1, $this->title); // Pour chaque attribut, cr�ation d'un champ de saisie foreach ($this->schemaTable as $nom => $options) { // D'abord v�rifier que la valeur par d�faut existe if (!isset($ligne[$nom])) { $ligne[$nom] = ""; } $this->addFormField($form, $action, $nom, $ligne[$nom], $options); } // OK. Now add lines for the slave table, if any if (!empty($this->slave_table)) { $form->debutTable(HORIZONTAL, array(), $this->size_slave_table); // Pour chaque attribut, cr�ation d'un champ de saisie foreach ($this->schema_slave as $nom => $options) { // D'abord v�rifier que la valeur par d�faut existe if (!isset($ligne[$this->slave_table][$nom])) { $valeur = ""; } else { $valeur = $ligne[$this->slave_table][$nom]; } // Attention � g�rer les cl�s �trang�res if (isset($this->foreign_keys[$nom])) { $options['cle_etrangere'] = 1; if ($action == MAJ_BD) { $valeur = $ligne[$this->foreign_keys[$nom]]; } } $html_field_name = "{$this->slave_table}[{$nom}][]"; $this->addFormField($form, $action, $nom, $valeur, $options, $html_field_name); } $form->finTable(); } $form->finTable(); if ($action == MAJ_BD) { $form->champValider("Modify", "submit"); } else { $form->champValider("Insert", "submit"); } return $form->formulaireHTML(); }