Subversion Repositories Applications.bazar

Rev

Rev 55 | Rev 57 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 55 Rev 56
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: bazar.fonct.php,v 1.20 2005-11-30 13:58:45 florian Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.21 2005-12-01 15:31:30 florian Exp $
23
/**
23
/**
24
*
24
*
25
* Fonctions du module bazar
25
* Fonctions du module bazar
26
*
26
*
27
*@package bazar
27
*@package bazar
28
//Auteur original :
28
//Auteur original :
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Florian Schmitt <florian@ecole-et-nature.org>
30
*@author        Florian Schmitt <florian@ecole-et-nature.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@copyright     Tela-Botanica 2000-2004
32
*@copyright     Tela-Botanica 2000-2004
33
*@version       $Revision: 1.20 $ $Date: 2005-11-30 13:58:45 $
33
*@version       $Revision: 1.21 $ $Date: 2005-12-01 15:31:30 $
34
// +------------------------------------------------------------------------------------------------------+
34
// +------------------------------------------------------------------------------------------------------+
35
*/
35
*/
Line 36... Line 36...
36
 
36
 
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
Line 240... Line 240...
240
	if (isset($_REQUEST['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_REQUEST['id_fiche'];
240
		if (isset($_REQUEST['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_REQUEST['id_fiche'];
241
	if (isset($_REQUEST['typeannonce'])) {
241
		if (isset($_REQUEST['typeannonce'])) {
242
		$GLOBALS['_BAZAR_']['typeannonce']=$_REQUEST['typeannonce'];
242
			$GLOBALS['_BAZAR_']['typeannonce']=$_REQUEST['typeannonce'];
243
		// Pour éviter qu'un formulaire soit revalidé si l'utilisateur
243
			// Pour éviter qu'un formulaire soit revalidé si l'utilisateur
244
		// Clique sur son bouton précédent
244
			// Clique sur son bouton précédent
245
		
-
 
246
		if ($mode == BAZ_ACTION_NOUVEAU) unset($_SESSION['formulaire_annonce_valide']) ;
245
			if ($mode == BAZ_ACTION_NOUVEAU) unset($_SESSION['formulaire_annonce_valide']) ;
247
	}
246
		}
Line 248... Line 247...
248
	
247
		
249
	//requete pour obtenir l'id du type d'annonce
248
		//requete pour obtenir l'id du type d'annonce
250
        if (isset($GLOBALS['_BAZAR_']['typeannonce'])) {
249
        if (isset($GLOBALS['_BAZAR_']['typeannonce'])) {
251
		$requete = 'SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"' ;
250
        	$requete = 'SELECT bn_id_nature, bn_condition FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"' ;
252
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
251
        	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
253
		if (DB::isError($resultat)) {
252
        	if (DB::isError($resultat)) {
254
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
253
        		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
255
		}
254
        	}
256
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
255
        	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
256
        		$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
257
			$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
257
        		$conditions=$ligne['bn_condition'];
258
		}
258
        	}
259
	}
259
       	}
-
 
260
       	$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
260
	$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
261
		
261
	//Definir le lien du formulaire en fonction du mode de formulaire choisi
262
		//Definir le lien du formulaire en fonction du mode de formulaire choisi
262
	if ($mode == 'inscription') $lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
263
		if ($mode == 'inscription') $lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
263
	if ($mode == BAZ_DEPOSER_ANNONCE) $lien_formulaire->addQueryString('action', BAZ_DEPOSER_ANNONCE);
264
		if ($mode == BAZ_DEPOSER_ANNONCE) $lien_formulaire->addQueryString('action', BAZ_DEPOSER_ANNONCE);
264
	if ($mode == BAZ_ACTION_NOUVEAU) {
265
		if ($mode == BAZ_ACTION_NOUVEAU) {
265
		if (!isset($_POST['accept_condition'])) {
266
			if ((!isset($_POST['accept_condition']))and($conditions!=NULL)) {
266
			$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU);
267
				$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU);
267
		} else {
268
			} else {
268
			$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
269
				$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
269
		}
270
			}
270
	}
271
		}
271
	if ($mode == BAZ_ACTION_MODIFIER) {
272
		if ($mode == BAZ_ACTION_MODIFIER) {
272
		if (!isset($_POST['accept_condition'])) {
273
			if (!isset($_POST['accept_condition'])and($conditions!=NULL)) {
273
			$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER);
274
				$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER);
274
		} else {
275
			} else {
275
			$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER_V);
276
				$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER_V);
276
		}		
277
			}		
Line 320... Line 321...
320
			$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
321
				$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
321
			if (($droitspers=='redacteur') or ($droitspers=='administrateur') or ($droitspers=='superadministrateur')) {
322
				if (($droitspers=='redacteur') or ($droitspers=='administrateur') or ($droitspers=='superadministrateur')) {
322
				$formtemplate->addElement('radio', 'typeannonce', '', '<strong>'.$ligne['bn_label_nature'].
323
					$formtemplate->addElement('radio', 'typeannonce', '', '<strong>'.$ligne['bn_label_nature'].
323
				           ':</strong><br />'.$ligne['bn_description'], $ligne['bn_label_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
324
				           ':</strong><br />'.$ligne['bn_description'], $ligne['bn_label_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
324
			}
325
				}		
325
			
-
 
326
		}
326
			}
327
		
-
 
328
		$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
327
			$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
Line 329... Line 328...
329
		
328
		
330
		//Mettre les annonces en choix par defaut
329
			//Mettre les annonces en choix par defaut
Line 340... Line 339...
340
	//------------------------------------------------------------------------------------------------
339
		//------------------------------------------------------------------------------------------------
341
	//AFFICHAGE DU FORMULAIRE CORRESPONDANT AU TYPE DE L'ANNONCE CHOISI PAR L'UTILISATEUR
340
		//AFFICHAGE DU FORMULAIRE CORRESPONDANT AU TYPE DE L'ANNONCE CHOISI PAR L'UTILISATEUR
342
	//------------------------------------------------------------------------------------------------
341
		//------------------------------------------------------------------------------------------------
343
	if ($mode == BAZ_ACTION_NOUVEAU) {
342
		if ($mode == BAZ_ACTION_NOUVEAU) {
344
		$res=baz_afficher_formulaire_annonce('insertion',$formtemplate);
343
			$res=baz_afficher_formulaire_annonce('insertion',$formtemplate);	
345
		
-
 
346
	}
344
		}
Line 347... Line 345...
347
	
345
	
348
	//------------------------------------------------------------------------------------------------
346
		//------------------------------------------------------------------------------------------------
349
	//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
347
		//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
Line 353... Line 351...
353
	}
351
		}
Line 354... Line 352...
354
	
352
		
355
	//------------------------------------------------------------------------------------------------
353
		//------------------------------------------------------------------------------------------------
356
	//CAS DE L'INSCRIPTION D'UNE ANNONCE
354
		//CAS DE L'INSCRIPTION D'UNE ANNONCE
357
	//------------------------------------------------------------------------------------------------
355
		//------------------------------------------------------------------------------------------------
358
	if ($mode == 'inscription') {
356
		if (($mode == 'inscription')or($mode == BAZ_ACTION_NOUVEAU_V)) {
359
		if ($formtemplate->validate() && !isset($_SESSION['formulaire_annonce_valide'])) {
357
			if ($formtemplate->validate() && !isset($_SESSION['formulaire_annonce_valide'])) {
360
			$formtemplate->process('baz_insertion', false) ;
358
				$formtemplate->process('baz_insertion', false) ;
361
			$_SESSION['formulaire_annonce_valide'] = 1;
359
				$_SESSION['formulaire_annonce_valide'] = 1;
362
			return;
360
				return;
Line 611... Line 609...
611
		if ($resultat->numRows()>0) {
609
		if ($resultat->numRows()>0) {
612
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
610
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
613
				$image=$ligne->bf_url_image;
611
				$image=$ligne->bf_url_image;
614
			}
612
			}
615
			if ($image!=NULL) {
613
			if ($image!=NULL) {
616
				$html='<tr><td colspan="2" width="600px"><hr /><img src="client/bazar/images/'.$image.'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
614
				$html='<hr /><img src="client/bazar/images/'.$image.'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
617
				$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
615
				$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
618
				$lien_supprimer->addQueryString('action', $_GET['action']);
616
				$lien_supprimer->addQueryString('action', $_GET['action']);
619
				$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
617
				$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
620
				$lien_supprimer->addQueryString('typeannonce', $_REQUEST['typeannonce']);
618
				$lien_supprimer->addQueryString('typeannonce', $_REQUEST['typeannonce']);
621
				$lien_supprimer->addQueryString('image', '2');
619
				$lien_supprimer->addQueryString('image', '2');
622
				$html.= '<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a></td></tr>'."\n";
620
				$html.= '<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n";
623
				$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
621
				$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
624
				$formimage->addElement('html', $html) ;
622
				$formimage->addElement('html', $html) ;
625
			}
623
			}
626
			else  {
624
			else  {
627
				$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
625
				$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
628
				$formimage->addElement('html', '<tr><td colspan="2" width="600px"><hr /><h3>'.BAZ_AJOUTER_IMAGE.'</h3></td></tr>') ;
626
				$formimage->addElement('html', '<hr /><h3>'.BAZ_AJOUTER_IMAGE.'</h3>') ;
629
				$formimage->addElement('file', 'image', BAZ_IMAGE) ;
627
				$formimage->addElement('file', 'image', BAZ_IMAGE) ;
630
				$formimage->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image
628
				$formimage->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image
631
				$formimage->setMaxFileSize(BAZ_TAILLE_MAX_FICHIER);
629
				$formimage->setMaxFileSize(BAZ_TAILLE_MAX_FICHIER);
632
				$formimage->addElement('submit', 'valider', BAZ_VALIDER);
630
				$formimage->addElement('submit', 'valider', BAZ_VALIDER);
633
			}
631
			}
634
		}
632
		}
635
		else {
633
		else {
636
			$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
634
			$formimage = new HTML_QuickForm('formulaire', 'post',  preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) ) ;
637
			$formimage->addElement('html', '<tr><td colspan="2" width="600px"><hr /><h3>'.BAZ_AJOUTER_IMAGE.'</h3></td></tr>') ;
635
			$formimage->addElement('html', '<hr /><h3>'.BAZ_AJOUTER_IMAGE.'</h3>'."\n") ;
638
			$formimage->addElement('file', 'image', BAZ_IMAGE) ;
636
			$formimage->addElement('file', 'image', BAZ_IMAGE) ;
639
			$formimage->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image
637
			$formimage->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image
640
			$formimage->setMaxFileSize(BAZ_TAILLE_MAX_FICHIER);
638
			$formimage->setMaxFileSize(BAZ_TAILLE_MAX_FICHIER);
641
			$formimage->addElement('submit', 'valider', BAZ_VALIDER);
639
			$formimage->addElement('submit', 'valider', BAZ_VALIDER);
642
		}
640
		}
Line 647... Line 645...
647
		$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
645
		$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
648
		if (DB::isError ($resultat)) {
646
		if (DB::isError ($resultat)) {
649
			die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
647
			die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
650
		}
648
		}
651
		if ($resultat->numRows()>0) {
649
		if ($resultat->numRows()>0) {
652
			$html= '<tr><td colspan="2" width="600px"><hr /><h3>'.BAZ_LISTE_URL.'</h3>'."\n";
650
			$html= '<hr /><h3>'.BAZ_LISTE_URL.'</h3>'."\n";
653
			$tableAttr = array("id" => "table_bazar") ;
651
			$tableAttr = array("id" => "table_bazar") ;
654
			$table = new HTML_Table($tableAttr) ;
652
			$table = new HTML_Table($tableAttr) ;
655
			$entete = array (BAZ_LIEN , BAZ_SUPPRIMER) ;
653
			$entete = array (BAZ_LIEN , BAZ_SUPPRIMER) ;
656
			$table->addRow($entete) ;
654
			$table->addRow($entete) ;
657
			$table->setRowType(0, "th") ;
655
			$table->setRowType(0, "th") ;
Line 669... Line 667...
669
				'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
667
				'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
670
				$lien_supprimer->removeQueryString('id_url');
668
				$lien_supprimer->removeQueryString('id_url');
671
			}
669
			}
672
			$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
670
			$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
673
			$table->updateColAttributes(1, array("align" => "center"));
671
			$table->updateColAttributes(1, array("align" => "center"));
674
			$html.= $table->toHTML().'</td></tr>' ;
672
			$html.= $table->toHTML()."\n" ;
675
		}
673
		}
676
		else {
674
		else {
677
			$html= '<tr><td colspan="2" width="600px"><hr /><h3>'.BAZ_PAS_URL.'</h3></td></tr>'."\n";
675
			$html= '<hr /><h3>'.BAZ_PAS_URL.'</h3>'."\n";
678
		}
676
		}
679
		$html.='<tr><td colspan="2" width="600px"><h4>'.BAZ_AJOUTER_URL.'</h4>'."\n";
677
		$html.='<h4>'.BAZ_AJOUTER_URL.'</h4>'."\n";
680
		$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
678
		$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
681
		$lien_formulaire->addQueryString('action', $_GET['action']);
679
		$lien_formulaire->addQueryString('action', $_GET['action']);
682
		$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
680
		$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
683
		$lien_formulaire->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
681
		$lien_formulaire->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
684
		$lien_formulaire->addQueryString('url', '1');
682
		$lien_formulaire->addQueryString('url', '1');
Line 695... Line 693...
695
		if (DB::isError ($resultat)) {
693
		if (DB::isError ($resultat)) {
696
			die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
694
			die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
697
		}
695
		}
Line 698... Line 696...
698
		
696
		
699
		if ($resultat->numRows()>0) {
697
		if ($resultat->numRows()>0) {
700
			$html= '<tr><td colspan="2" width="600px"><hr /><h3>'.BAZ_LISTE_FICHIERS_JOINTS.'</h3>'."\n";
698
			$html= '<hr /><h3>'.BAZ_LISTE_FICHIERS_JOINTS.'</h3>'."\n";
701
			$tableAttr = array("id" => "table_bazar") ;
699
			$tableAttr = array("id" => "table_bazar") ;
702
			$table = new HTML_Table($tableAttr) ;
700
			$table = new HTML_Table($tableAttr) ;
703
			$entete = array (BAZ_FICHIER , BAZ_SUPPRIMER) ;
701
			$entete = array (BAZ_FICHIER , BAZ_SUPPRIMER) ;
704
			$table->addRow($entete) ;
702
			$table->addRow($entete) ;
Line 716... Line 714...
716
					'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
714
					'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
717
					$lien_supprimer->removeQueryString('id_fichier');
715
					$lien_supprimer->removeQueryString('id_fichier');
718
			}
716
			}
719
			$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
717
			$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
720
			$table->updateColAttributes(1, array("align" => "center"));
718
			$table->updateColAttributes(1, array("align" => "center"));
721
			$html.= $table->toHTML().'</td></tr>' ;
719
			$html.= $table->toHTML()."\n" ;
722
		}
720
		}
723
		else {
721
		else {
724
			$html= '<tr><td colspan="2"><hr /><h3>'.BAZ_PAS_DE_FICHIERS_JOINTS.'</h3></td></tr>'."\n";
722
			$html= '<hr /><h3>'.BAZ_PAS_DE_FICHIERS_JOINTS.'</h3>'."\n";
725
		}
723
		}
726
		$html.='<tr><td colspan="2" width="600px"><h4>'.BAZ_AJOUTER_FICHIER_JOINT.'</h4>'.'</td></tr>'."\n";
724
		$html.='<h4>'.BAZ_AJOUTER_FICHIER_JOINT.'</h4>'."\n";
727
		$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
725
		$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
728
		$lien_formulaire->addQueryString('action', $_GET['action']);
726
		$lien_formulaire->addQueryString('action', $_GET['action']);
729
		$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
727
		$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
730
		$lien_formulaire->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
728
		$lien_formulaire->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
731
		$lien_formulaire->addQueryString('fichier', '1');
729
		$lien_formulaire->addQueryString('fichier', '1');
Line 1246... Line 1244...
1246
	if (isset($_POST['type_annonce'])) {
1244
	if (isset($_POST['type_annonce'])) {
1247
		//ajout des champs pour la recherche personnalisée
1245
		//ajout des champs pour la recherche personnalisée
1248
		if ($_POST['type_annonce']!='toutes') {
1246
		if ($_POST['type_annonce']!='toutes') {
1249
			$tableau=baz_valeurs_template($_POST['type_annonce'].'.tpl');
1247
			$tableau=baz_valeurs_template($_POST['type_annonce'].'.tpl');
1250
			$nbvaleurs=count($tableau);
1248
			$nbvaleurs=count($tableau);
1251
			$html='<tr><td colspan="2" width="600px"><h3>'.BAZ_RECHERCHE_AVANCEE.'</h3></td></tr>'."\n";
1249
			$html='<h3>'.BAZ_RECHERCHE_AVANCEE.'</h3>'."\n";
1252
			$formtemplate->addElement('html', $html) ;
1250
			$formtemplate->addElement('html', $html) ;
1253
			for ($i=0; $i<$nbvaleurs; $i++) {
1251
			for ($i=0; $i<$nbvaleurs; $i++) {
1254
				if (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='listedatedeb')or($tableau[$i]['type']=='listedatefin')) {
1252
				if (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='listedatedeb')or($tableau[$i]['type']=='listedatefin')) {
1255
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
1253
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
1256
					$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], 0) ;
1254
					$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], 0) ;
Line 1303... Line 1301...
1303
	$body .= "-------------------------------------------\n" ;
1301
	$body .= "-------------------------------------------\n" ;
Line 1304... Line 1302...
1304
	
1302
	
1305
	// création du mail
1303
	// création du mail
1306
	$mail_object =& Mail::factory('mail');
1304
	$mail_object =& Mail::factory('mail');
1307
	if (!mail ($headers['To'], $headers['Subject'], $body)) {
1305
	if (!mail ($headers['To'], $headers['Subject'], $body)) {
1308
		return "<tr><td>Une erreur s'est produite:<br></td></tr>\n" ;
1306
		return "Une erreur s'est produite:<br />\n" ;
1309
	}
1307
	}
Line 1310... Line 1308...
1310
	$body .= INS_MAIL_INSCRIPTION_2;
1308
	$body .= INS_MAIL_INSCRIPTION_2;
Line 1311... Line 1309...
1311
	
1309
	
1312
	$headers['To']      = $_POST['mail'] ;
1310
	$headers['To']      = $_POST['mail'] ;
1313
	
1311
	
1314
	// création du mail
1312
	// création du mail
1315
	if (mail($headers['To'], $headers['Subject'], INS_MAIL_INSCRIPTION_1.$body)) {
1313
	if (mail($headers['To'], $headers['Subject'], INS_MAIL_INSCRIPTION_1.$body)) {
1316
		return "<tr><td>Une erreur s'est produite<br></td></tr>\n" ;
1314
		return "Une erreur s'est produite<br />\n" ;
Line 1343... Line 1341...
1343
}
1341
}
Line 1344... Line 1342...
1344
 
1342
 
1345
/* +--Fin du code ----------------------------------------------------------------------------------------+
1343
/* +--Fin du code ----------------------------------------------------------------------------------------+
1346
*
1344
*
-
 
1345
* $Log: not supported by cvs2svn $
-
 
1346
* Revision 1.20  2005/11/30 13:58:45  florian
-
 
1347
* ajouts graphisme (logos, boutons), changement structure SQL bazar_fiche
1347
* $Log: not supported by cvs2svn $
1348
*
1348
* Revision 1.19  2005/11/24 16:17:13  florian
1349
* Revision 1.19  2005/11/24 16:17:13  florian
1349
* corrections bugs, ajout des cases à cocher
1350
* corrections bugs, ajout des cases à cocher
1350
*
1351
*
1351
* Revision 1.18  2005/11/18 16:03:23  florian
1352
* Revision 1.18  2005/11/18 16:03:23  florian