Subversion Repositories Applications.bazar

Rev

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

Rev 271 Rev 286
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.67 2007-07-04 10:01:30 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.68 2007-08-27 12:31:31 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.67 $ $Date: 2007-07-04 10:01:30 $
34
*@version       $Revision: 1.68 $ $Date: 2007-08-27 12:31:31 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 163... Line 163...
163
	else {
163
	else {
164
		$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE_A_VALIDER.'</p>'."\n" ;
164
		$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE_A_VALIDER.'</p>'."\n" ;
165
	}
165
	}
166
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
166
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
Line 167... Line 167...
167
	
167
	
Line 168... Line 168...
168
	$res .= '<br /><ul style="clear:both;"><li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_CONSULTER_FICHES_VALIDEES.'">'.BAZ_CONSULTER_FICHES_VALIDEES.'</a></li></ul>';
168
	//$res .= '<br /><ul style="clear:both;"><li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_CONSULTER_FICHES_VALIDEES.'">'.BAZ_CONSULTER_FICHES_VALIDEES.'</a></li></ul>';
169
 
169
 
170
	// Nettoyage de l'url
170
	// Nettoyage de l'url
171
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
171
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
Line 260... Line 260...
260
*
260
*
261
* @return   string  HTML
261
* @return   string  HTML
262
*/
262
*/
263
function mes_fiches() {
263
function mes_fiches() {
264
	$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
264
	$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
265
	if ($GLOBALS['AUTH']->getAuth()) {		
265
	if ($GLOBALS['AUTH']->getAuth()) {
266
		// requete pour voir si l'utilisateur a des fiches a son nom, classees par date de MAJ et nature d'annonce
266
		// requete pour voir si l'utilisateur a des fiches a son nom, classees par date de MAJ et nature d'annonce
267
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
267
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
268
		           ' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC';
268
		           ' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC';
269
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
269
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
270
		if (DB::isError($resultat)) {
270
		if (DB::isError($resultat)) {
Line 322... Line 322...
322
	    $GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
322
	    $GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
323
		$res .= '<br /><ul id="liste_liens"><li id="lien_saisir"><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'">'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'</a></li></ul>';
323
		$res .= '<br /><ul id="liste_liens"><li id="lien_saisir"><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'">'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'</a></li></ul>';
324
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');	    
324
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');	    
325
	}
325
	}
326
	else  { 
326
	else  { 
327
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
327
	/*	$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
328
		$res .= '<form id="form_connexion" class="form_identification" action="' ;
328
		$res .= '<form id="form_connexion" class="form_identification" action="' ;
329
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
329
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
330
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
330
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
331
		$res .= '" method="post">
331
		$res .= '" method="post">
332
                <fieldset>
332
                <fieldset>
Line 340... Line 340...
340
                </form>';
340
                </form>';
341
	}
341
	}
342
	// Nettoyage de l'url
342
	// Nettoyage de l'url
343
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
343
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
344
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
344
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
345
	$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
345
	$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');*/
-
 
346
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
-
 
347
    $modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
-
 
348
    $res .= $modele->getTemplate(BAZ_TEMPLATE_MESSAGE_LOGIN, $GLOBALS['_BAZAR_']['langue']);
346
	
349
	}
347
	return $res;
350
	return $res;
348
}
351
}
Line 349... Line 352...
349
 
352
 
350
/** baz_gestion_droits() interface de gestion des droits
353
/** baz_gestion_droits() interface de gestion des droits
Line 601... Line 604...
601
			$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
604
			$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
602
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
605
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
603
			if (DB::isError($resultat)) {
606
			if (DB::isError($resultat)) {
604
				return ($resultat->getMessage().$resultat->getDebugInfo()) ;
607
				return ($resultat->getMessage().$resultat->getDebugInfo()) ;
605
			}
608
			}
606
			$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
609
			//$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
-
 
610
			include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
-
 
611
	        $modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
-
 
612
	        $res .= $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE_ACCUEIL, $GLOBALS['_BAZAR_']['langue']);
607
			if ($resultat->numRows()==1) {
613
			if ($resultat->numRows()==1) {
608
				$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
614
				$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
609
				$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
615
				$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
610
				$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
616
				$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
611
				$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
617
				$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
Line 659... Line 665...
659
		//------------------------------------------------------------------------------------------------
665
		//------------------------------------------------------------------------------------------------
660
		if ($mode == BAZ_ACTION_NOUVEAU) {
666
		if ($mode == BAZ_ACTION_NOUVEAU) {
661
			unset ($_SESSION['formulaire_annonce_valide']) ;
667
			unset ($_SESSION['formulaire_annonce_valide']) ;
662
			$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
668
			$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
663
			$formtemplate->updateAttributes(array('action' => str_replace('&amp;', '&', $lien_formulaire->getURL())));
669
			$formtemplate->updateAttributes(array('action' => str_replace('&amp;', '&', $lien_formulaire->getURL())));
-
 
670
			// Appel du modele
-
 
671
			include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
-
 
672
	        $modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
-
 
673
	        $html = $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE, $GLOBALS['_BAZAR_']['langue'],$GLOBALS['_BAZAR_']['categorie_nature']);
-
 
674
	        if (!PEAR::isError($html)) {
-
 
675
				$res = str_replace ('{FORMULAIRE}', baz_afficher_formulaire_annonce('insertion',$formtemplate), $html);
664
 
-
 
-
 
676
	        } else {
665
			$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);	
677
	        	$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);
-
 
678
	        }	
666
		}
679
		}
Line 667... Line 680...
667
	
680
	
668
		//------------------------------------------------------------------------------------------------
681
		//------------------------------------------------------------------------------------------------
669
		//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
682
		//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
Line 745... Line 758...
745
			baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
758
			baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
746
		}		
759
		}		
747
	}
760
	}
Line 748... Line 761...
748
	
761
	
749
	//titre de la rubrique
762
	//titre de la rubrique
750
	$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.'&nbsp;'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
763
	if (!BAZ_UTILISE_TEMPLATE) $res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.'&nbsp;'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
751
	if (($GLOBALS['_BAZAR_']['condition']!='')AND(!isset($_POST['accept_condition']))AND(!isset($_GET['url'])OR(!isset($_GET['fichier']))OR(!isset($_GET['image'])))) {
764
	if (($GLOBALS['_BAZAR_']['condition']!='')AND(!isset($_POST['accept_condition']))AND(!isset($_GET['url'])OR(!isset($_GET['fichier']))OR(!isset($_GET['image'])))) {
752
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
765
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
753
		$conditions= new HTML_QuickForm_html('<tr><td colspan="2" style="padding:5px; margin:5px; width: 90%; background: #C1CBA7;">'.$GLOBALS['_BAZAR_']['condition'].'</td>'."\n".'</tr>'."\n");
766
		$conditions= new HTML_QuickForm_html('<tr><td colspan="2" style="padding:5px; margin:5px; width: 90%; background: #C1CBA7;">'.$GLOBALS['_BAZAR_']['condition'].'</td>'."\n".'</tr>'."\n");
754
		$formtemplate->addElement($conditions);
767
		$formtemplate->addElement($conditions);
Line 1407... Line 1420...
1407
}
1420
}
Line 1408... Line 1421...
1408
 
1421
 
1409
/* +--Fin du code ----------------------------------------------------------------------------------------+
1422
/* +--Fin du code ----------------------------------------------------------------------------------------+
1410
*
1423
*
-
 
1424
* $Log: not supported by cvs2svn $
-
 
1425
* Revision 1.67  2007-07-04 10:01:30  alexandre_tb
-
 
1426
* mise en place de divers templates :
-
 
1427
*  - mail pour admin (sujet et corps)
-
 
1428
*  - modele carte_google
-
 
1429
* ajout de lignes dans bazar_template
1411
* $Log: not supported by cvs2svn $
1430
*
1412
* Revision 1.66  2007-06-25 12:15:06  alexandre_tb
1431
* Revision 1.66  2007-06-25 12:15:06  alexandre_tb
1413
* merge from narmer
1432
* merge from narmer
1414
*
1433
*
1415
* Revision 1.65  2007-06-25 08:31:17  alexandre_tb
1434
* Revision 1.65  2007-06-25 08:31:17  alexandre_tb