Subversion Repositories Applications.bazar

Rev

Rev 81 | Rev 87 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 81 Rev 86
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.37 2006-01-24 14:11:11 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.38 2006-01-30 10:27:04 florian Exp $
23
/**
23
/**
24
*
24
*
25
* Fonctions du module bazar
25
* Fonctions du module bazar
26
* 
26
* 
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
*@author        Florian Schmitt <florian@ecole-et-nature.org>
31
*@author        Florian Schmitt <florian@ecole-et-nature.org>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.37 $ $Date: 2006-01-24 14:11:11 $
34
*@version       $Revision: 1.38 $ $Date: 2006-01-30 10:27:04 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 459... Line 459...
459
		//------------------------------------------------------------------------------------------------
459
		//------------------------------------------------------------------------------------------------
460
		if ($mode == BAZ_DEPOSER_ANNONCE) {
460
		if ($mode == BAZ_DEPOSER_ANNONCE) {
461
			$res = '';		
461
			$res = '';		
462
			//requete pour obtenir le nom et la description des types d'annonce
462
			//requete pour obtenir le nom et la description des types d'annonce
463
			$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition, bn_image_titre ".
463
			$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition, bn_image_titre ".
464
						"FROM bazar_nature WHERE bn_ce_id_menu=".$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.
464
						"FROM bazar_nature WHERE bn_ce_id_menu=".$GLOBALS['_BAZAR_']['categorie_nature'].
465
						" or  bn_ce_id_menu=0 ORDER BY bn_label_nature ASC";
465
						" ORDER BY bn_label_nature ASC";
466
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
466
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
467
			if (DB::isError($resultat)) {
467
			if (DB::isError($resultat)) {
468
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
468
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
469
			}
469
			}
470
			$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
470
			$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
471
			$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
471
			$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
472
			while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
472
			while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
473
				$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
473
				$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
474
				if (($droitspers=='redacteur') or ($droitspers=='administrateur') 
474
				if (($droitspers=='redacteur') or ($droitspers=='administrateur') 
475
								or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
475
								or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
476
					if (isset($ligne['bn_image_titre'])) {
476
					if ($ligne['bn_image_titre']!='') {
477
						$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.
477
						$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.
478
										constant($ligne['bn_label_nature']).'" />'.'<br />'."\n";
478
										constant($ligne['bn_label_nature']).'" />'.'<br />'."\n";
479
					} else {
479
					} else {
480
						$titre='<strong>'.constant($ligne['bn_label_nature']).' : </strong><br />'."\n";
480
						$titre='<h3>'.constant($ligne['bn_label_nature']).' : </h3>'."\n";
481
					}
481
					}
482
					$formtemplate->addElement('radio', 'typeannonce', '', $titre.$ligne['bn_description'].'<br /><br />'."\n", $ligne['bn_id_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
482
					$formtemplate->addElement('radio', 'typeannonce', '', $titre.$ligne['bn_description'].'<br /><br />'."\n", $ligne['bn_id_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
483
				}		
483
				}		
484
			}
484
			}
485
			$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
485
			$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
Line 567... Line 567...
567
		$formtemplate->addRule('accept_condition', BAZ_ACCEPTE_CONDITIONS_REQUIS, 'required', '', 'client') ;
567
		$formtemplate->addRule('accept_condition', BAZ_ACCEPTE_CONDITIONS_REQUIS, 'required', '', 'client') ;
568
		$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
568
		$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
569
	}
569
	}
570
	//affichage du formulaire si conditions acceptées
570
	//affichage du formulaire si conditions acceptées
571
	else {		
571
	else {		
572
	//Parcours du fichier de templates, pour mettre les champs specifiques	
572
	//Parcours du fichier de templates, pour mettre les valeurs des champs	
573
	$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
573
	$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
574
	if ($mode=='modification') {
574
	if ($mode=='modification') {
575
		//Ajout des valeurs par defaut
575
		//Ajout des valeurs par defaut
576
		$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
576
		$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
577
		for ($i=0; $i<count($tableau); $i++) {
577
		for ($i=0; $i<count($tableau); $i++) {
Line 1289... Line 1289...
1289
}
1289
}
Line 1290... Line 1290...
1290
 
1290
 
1291
/* +--Fin du code ----------------------------------------------------------------------------------------+
1291
/* +--Fin du code ----------------------------------------------------------------------------------------+
1292
*
1292
*
-
 
1293
* $Log: not supported by cvs2svn $
-
 
1294
* Revision 1.37  2006/01/24 14:11:11  alexandre_tb
-
 
1295
* correction de bug sur l'ajout d'une image et d'un fichier
1293
* $Log: not supported by cvs2svn $
1296
*
1294
* Revision 1.36  2006/01/19 17:42:11  florian
1297
* Revision 1.36  2006/01/19 17:42:11  florian
1295
* ajout des cases à cocher pré-cochées pour les maj
1298
* ajout des cases à cocher pré-cochées pour les maj
1296
*
1299
*
1297
* Revision 1.35  2006/01/18 11:06:51  florian
1300
* Revision 1.35  2006/01/18 11:06:51  florian