Subversion Repositories Applications.bazar

Rev

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

Rev 323 Rev 328
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.72 2007-10-22 10:09:21 florian Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.73 2007-10-24 13:27:00 alexandre_tb 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.72 $ $Date: 2007-10-22 10:09:21 $
34
*@version       $Revision: 1.73 $ $Date: 2007-10-24 13:27:00 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 728... Line 728...
728
		if ($mode=='modification') {
728
		if ($mode=='modification') {
729
			//Ajout des valeurs par defaut
729
			//Ajout des valeurs par defaut
730
			$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
730
			$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
Line 731... Line 731...
731
			
731
			
732
			for ($i=0; $i<count($tableau); $i++) {
732
			for ($i=0; $i<count($tableau); $i++) {
733
				if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
733
				if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox') {
734
					$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
734
					$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
735
				}
735
				}
-
 
736
				elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' 
-
 
737
							|| $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='champs_cache'
736
				elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='champs_cache') {
738
							|| $tableau[$i]['type']=='labelhtml' ) {
737
					$def=$tableau[$i]['nom_bdd'];					
739
					$def=$tableau[$i]['nom_bdd'];					
738
				} elseif ($tableau[$i]['type']=='carte_google') {
740
				} elseif ($tableau[$i]['type']=='carte_google') {
739
					$def = 'carte_google';
741
					$def = 'carte_google';
740
					$valeurs_par_defaut[$def] = array ('latitude' => $valeurs_par_defaut['bf_latitude'], 'longitude' => $valeurs_par_defaut['bf_longitude']);
742
					$valeurs_par_defaut[$def] = array ('latitude' => $valeurs_par_defaut['bf_latitude'], 'longitude' => $valeurs_par_defaut['bf_longitude']);
-
 
743
				}
-
 
744
				// certain type n ont pas de valeur par defaut (labelhtml par exemple)
741
				}
745
				// on teste l existence de $valeur_par_defaut[$def] avant de le passer en parametre
-
 
746
				$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
-
 
747
			                         $tableau[$i]['limite2'], 
742
				$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
748
			                         isset ($valeurs_par_defaut[$def]) ? $valeurs_par_defaut[$def] : '', 
743
			                         $tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
749
			                         $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
744
				if ($tableau[$i]['type']=='carte_google') {
750
				if ($tableau[$i]['type']=='carte_google') {
745
					include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
751
					include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
746
    				GEN_stockerCodeScript($script);
752
    				GEN_stockerCodeScript($script);
747
				}	           
753
				}	           
Line 833... Line 839...
833
			if (isset($valeur['texte_fichier'.$tableau[$i]['nom_bdd']]) && $valeur['texte_fichier'.$tableau[$i]['nom_bdd']]!='') {
839
			if (isset($valeur['texte_fichier'.$tableau[$i]['nom_bdd']]) && $valeur['texte_fichier'.$tableau[$i]['nom_bdd']]!='') {
834
				baz_insertion_fichier($valeur['texte_fichier'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche'], 'fichier'.$tableau[$i]['nom_bdd']);
840
				baz_insertion_fichier($valeur['texte_fichier'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche'], 'fichier'.$tableau[$i]['nom_bdd']);
835
			} 
841
			} 
836
		}		
842
		}		
837
		//cas des urls
843
		//cas des urls
-
 
844
		// On affine les criteres pour l insertion d une url
-
 
845
		// il faut que le lien soit saisie, different de http:// ET que le texte du lien soit saisie aussi
-
 
846
		// et ce afin d eviter d avoir des liens vides
838
		elseif ($tableau[$i]['type']=='url') {
847
		elseif ($tableau[$i]['type']=='url') {
839
			if (isset($valeur['url_lien'.$tableau[$i]['nom_bdd']]) && $valeur['url_lien'.$tableau[$i]['nom_bdd']]!='' ) {
848
			if (isset($valeur['url_lien'.$tableau[$i]['nom_bdd']]) && 
-
 
849
						$valeur['url_lien'.$tableau[$i]['nom_bdd']]!='http://'
-
 
850
						&& isset($valeur['url_texte'.$tableau[$i]['nom_bdd']]) &&
-
 
851
						strlen ($valeur['url_texte'.$tableau[$i]['nom_bdd']])) {
840
				baz_insertion_url($valeur['url_lien'.$tableau[$i]['nom_bdd']], $valeur['url_texte'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche']);
852
				baz_insertion_url($valeur['url_lien'.$tableau[$i]['nom_bdd']], $valeur['url_texte'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche']);
841
			}
853
			}
842
		}
854
		}
843
		//cas des images
855
		//cas des images
844
		elseif ($tableau[$i]['type']=='image') {
856
		elseif ($tableau[$i]['type']=='image') {
Line 944... Line 956...
944
	$requete = 'INSERT INTO bazar_url SET bu_id_url='.$id_url.', bu_ce_fiche='.$idfiche.', '.
956
	$requete = 'INSERT INTO bazar_url SET bu_id_url='.$id_url.', bu_ce_fiche='.$idfiche.', '.
945
		   'bu_url="'.$url_lien.'", bu_descriptif_url="'.addslashes($url_texte).'"';
957
		   'bu_url="'.$url_lien.'", bu_descriptif_url="'.addslashes($url_texte).'"';
Line 946... Line 958...
946
	
958
	
947
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
959
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
948
        if (DB::isError($resultat)) {
960
        if (DB::isError($resultat)) {
949
            die ($resultat->getMessage().$resultat->getDebugInfo()) ;
961
            return $resultat->getMessage().$resultat->getDebugInfo() ;
950
        }
962
        }
951
	return;
963
	return;
Line 1374... Line 1386...
1374
}
1386
}
Line 1375... Line 1387...
1375
 
1387
 
1376
/* +--Fin du code ----------------------------------------------------------------------------------------+
1388
/* +--Fin du code ----------------------------------------------------------------------------------------+
1377
*
1389
*
-
 
1390
* $Log: not supported by cvs2svn $
-
 
1391
* Revision 1.72  2007-10-22 10:09:21  florian
-
 
1392
* correction template
1378
* $Log: not supported by cvs2svn $
1393
*
1379
* Revision 1.71  2007-10-22 09:18:39  alexandre_tb
1394
* Revision 1.71  2007-10-22 09:18:39  alexandre_tb
1380
* prise en compte de la langue dans les requetes sur bazar_nature
1395
* prise en compte de la langue dans les requetes sur bazar_nature
1381
*
1396
*
1382
* Revision 1.70  2007-10-10 13:26:36  alexandre_tb
1397
* Revision 1.70  2007-10-10 13:26:36  alexandre_tb