Line 780... |
Line 780... |
780 |
$element = Bazar_element::factory($type, $tableau[$i]);
|
780 |
$element = Bazar_element::factory($type, $tableau[$i]);
|
781 |
if (!PEAR::isError($element)) {
|
781 |
if (!PEAR::isError($element)) {
|
782 |
if (method_exists($element, 'toForm'))$res .= $element->toForm($valeur);
|
782 |
if (method_exists($element, 'toForm'))$res .= $element->toForm($valeur);
|
783 |
}
|
783 |
}
|
784 |
*/
|
784 |
*/
|
785 |
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox') {
|
785 |
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' || $tableau[$i]['type']=='radio') {
|
786 |
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
|
786 |
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
|
787 |
}
|
787 |
}
|
788 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb'
|
788 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb'
|
789 |
|| $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='champs_cache'
|
789 |
|| $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='champs_cache'
|
790 |
|| $tableau[$i]['type']=='labelhtml' ) {
|
790 |
|| $tableau[$i]['type']=='labelhtml' ) {
|
Line 797... |
Line 797... |
797 |
// on teste l existence de $valeur_par_defaut[$def] avant de le passer en parametre
|
797 |
// on teste l existence de $valeur_par_defaut[$def] avant de le passer en parametre
|
798 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
798 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
799 |
$tableau[$i]['limite2'],
|
799 |
$tableau[$i]['limite2'],
|
800 |
isset ($valeurs_par_defaut[$def]) ? $valeurs_par_defaut[$def] : '',
|
800 |
isset ($valeurs_par_defaut[$def]) ? $valeurs_par_defaut[$def] : '',
|
801 |
$tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
801 |
$tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
- |
|
802 |
|
802 |
if ($tableau[$i]['type']=='carte_google') {
|
803 |
if ($tableau[$i]['type']=='carte_google') {
|
803 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
804 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
804 |
GEN_stockerCodeScript($script);
|
805 |
GEN_stockerCodeScript($script);
|
805 |
// On ajoute l attribut load a la balise body
|
806 |
// On ajoute l attribut load a la balise body
|
806 |
GEN_AttributsBody('onload', 'load()');
|
807 |
GEN_AttributsBody('onload', 'load()');
|
807 |
}
|
808 |
}
|
808 |
}
|
809 |
}
|
809 |
}
|
810 |
}
|
810 |
else {
|
811 |
else {
|
811 |
for ($i=0; $i<count($tableau); $i++) {
|
812 |
for ($i=0; $i<count($tableau); $i++) {
|
- |
|
813 |
if($tableau[$i]['type'] != '') {
|
812 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
814 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
813 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
815 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
814 |
if ($tableau[$i]['type'] == 'carte_google') {
|
816 |
if ($tableau[$i]['type'] == 'carte_google') {
|
815 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
817 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
816 |
GEN_stockerCodeScript($script);
|
818 |
GEN_stockerCodeScript($script);
|
817 |
// On ajoute l attribut load a la balise body
|
819 |
// On ajoute l attribut load a la balise body
|
818 |
GEN_AttributsBody('onload', 'load()');
|
820 |
GEN_AttributsBody('onload', 'load()');
|
819 |
}
|
821 |
}
|
820 |
}
|
822 |
}
|
821 |
}
|
823 |
}
|
- |
|
824 |
}
|
822 |
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
|
825 |
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
|
Line 823... |
Line 826... |
823 |
|
826 |
|
824 |
// Un champs cache pour la duplication
|
827 |
// Un champs cache pour la duplication
|
825 |
if ($mode == 'duplication') $formtemplate->addElement('hidden', 'fiche_dupliquee', $GLOBALS['_BAZAR_']['id_fiche']);
|
828 |
if ($mode == 'duplication') $formtemplate->addElement('hidden', 'fiche_dupliquee', $GLOBALS['_BAZAR_']['id_fiche']);
|
Line 1445... |
Line 1448... |
1445 |
}
|
1448 |
}
|
1446 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
|
1449 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
|
1447 |
$valeurs_fiche = array() ;
|
1450 |
$valeurs_fiche = array() ;
|
1448 |
$tableau = baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
1451 |
$tableau = baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
1449 |
for ($i=0; $i<count($tableau); $i++) {
|
1452 |
for ($i=0; $i<count($tableau); $i++) {
|
1450 |
if ($tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox') {
|
1453 |
if ($tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' || $tableau[$i]['type']=='radio') {
|
1451 |
$requete = 'SELECT bfvl_valeur FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$idfiche.
|
1454 |
$requete = 'SELECT bfvl_valeur FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$idfiche.
|
1452 |
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'];
|
1455 |
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'];
|
1453 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
1456 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
1454 |
if (DB::isError ($resultat)) {
|
1457 |
if (DB::isError ($resultat)) {
|
1455 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
1458 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|