| 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.69 2007-09-18 07:39:42 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.69 $ $Date: 2007-09-18 07:39:42 $
|
| 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 259... |
Line 259... |
| 259 |
/** mes_fiches () - Renvoie les fiches bazar d'un utilisateur
|
259 |
/** mes_fiches () - Renvoie les fiches bazar d'un utilisateur
|
| 260 |
*
|
260 |
*
|
| 261 |
* @return string HTML
|
261 |
* @return string HTML
|
| 262 |
*/
|
262 |
*/
|
| 263 |
function mes_fiches() {
|
263 |
function mes_fiches() {
|
| 264 |
|
- |
|
| - |
|
264 |
$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
|
| 265 |
if ($GLOBALS['AUTH']->getAuth()) {
|
265 |
if ($GLOBALS['AUTH']->getAuth()) {
|
| 266 |
$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
|
- |
|
| 267 |
// 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
|
| 268 |
$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'].
|
| 269 |
' 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';
|
| 270 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
269 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
| 271 |
if (DB::isError($resultat)) {
|
270 |
if (DB::isError($resultat)) {
|
| Line 325... |
Line 324... |
| 325 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
324 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
| 326 |
}
|
325 |
}
|
| 327 |
else {
|
326 |
else {
|
| 328 |
$res .= BAZ_IDENTIFIEZ_VOUS_PRESENTATION_XHTML;
|
327 |
$res .= BAZ_IDENTIFIEZ_VOUS_PRESENTATION_XHTML;
|
| 329 |
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
|
328 |
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
|
| 330 |
$res .= '<form id="form_connexion" class="form_identification" action="' ;
|
329 |
/*$res .= '<form id="form_connexion" class="form_identification" action="' ;
|
| 331 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
|
330 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
|
| 332 |
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
|
331 |
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
|
| 333 |
$res .= '" method="post">
|
332 |
$res .= '" method="post">
|
| 334 |
<fieldset>
|
333 |
<fieldset>
|
| 335 |
<legend>Identifiez vous</legend>
|
334 |
<legend>Identifiez vous</legend>
|
| Line 342... |
Line 341... |
| 342 |
</form>';
|
341 |
</form>';
|
| 343 |
}
|
342 |
}
|
| 344 |
// Nettoyage de l'url
|
343 |
// Nettoyage de l'url
|
| 345 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
344 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
| 346 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
345 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
| 347 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
|
346 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');*/
|
| - |
|
347 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
| - |
|
348 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
| - |
|
349 |
$res .= $modele->getTemplate(BAZ_TEMPLATE_MESSAGE_LOGIN, $GLOBALS['_BAZAR_']['langue']);
|
| 348 |
|
350 |
}
|
| 349 |
return $res;
|
351 |
return $res;
|
| 350 |
}
|
352 |
}
|
| Line 351... |
Line 353... |
| 351 |
|
353 |
|
| 352 |
/** baz_gestion_droits() interface de gestion des droits
|
354 |
/** baz_gestion_droits() interface de gestion des droits
|
| Line 603... |
Line 605... |
| 603 |
$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
|
605 |
$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
|
| 604 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
606 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
| 605 |
if (DB::isError($resultat)) {
|
607 |
if (DB::isError($resultat)) {
|
| 606 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
608 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
| 607 |
}
|
609 |
}
|
| 608 |
$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
610 |
//$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
| - |
|
611 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
| - |
|
612 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
| - |
|
613 |
$res .= $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE_ACCUEIL, $GLOBALS['_BAZAR_']['langue']);
|
| 609 |
if ($resultat->numRows()==1) {
|
614 |
if ($resultat->numRows()==1) {
|
| 610 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
615 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
| 611 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
616 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
| 612 |
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
|
617 |
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
|
| 613 |
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
|
618 |
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
|
| Line 661... |
Line 666... |
| 661 |
//------------------------------------------------------------------------------------------------
|
666 |
//------------------------------------------------------------------------------------------------
|
| 662 |
if ($mode == BAZ_ACTION_NOUVEAU) {
|
667 |
if ($mode == BAZ_ACTION_NOUVEAU) {
|
| 663 |
unset ($_SESSION['formulaire_annonce_valide']) ;
|
668 |
unset ($_SESSION['formulaire_annonce_valide']) ;
|
| 664 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
|
669 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
|
| 665 |
$formtemplate->updateAttributes(array('action' => str_replace('&', '&', $lien_formulaire->getURL())));
|
670 |
$formtemplate->updateAttributes(array('action' => str_replace('&', '&', $lien_formulaire->getURL())));
|
| - |
|
671 |
// Appel du modele
|
| - |
|
672 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
| - |
|
673 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
| - |
|
674 |
$html = $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE, $GLOBALS['_BAZAR_']['langue'],$GLOBALS['_BAZAR_']['categorie_nature']);
|
| - |
|
675 |
if (!PEAR::isError($html)) {
|
| - |
|
676 |
$res = str_replace ('{FORMULAIRE}', baz_afficher_formulaire_annonce('insertion',$formtemplate), $html);
|
| 666 |
|
- |
|
| - |
|
677 |
} else {
|
| 667 |
$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);
|
678 |
$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);
|
| - |
|
679 |
}
|
| 668 |
}
|
680 |
}
|
| Line 669... |
Line 681... |
| 669 |
|
681 |
|
| 670 |
//------------------------------------------------------------------------------------------------
|
682 |
//------------------------------------------------------------------------------------------------
|
| 671 |
//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
|
683 |
//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
|
| Line 745... |
Line 757... |
| 745 |
}
|
757 |
}
|
| 746 |
if (isset($_GET['image'])) {
|
758 |
if (isset($_GET['image'])) {
|
| 747 |
baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
|
759 |
baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
|
| 748 |
}
|
760 |
}
|
| 749 |
}
|
761 |
}
|
| 750 |
|
762 |
$res = '';
|
| 751 |
//titre de la rubrique
|
763 |
//titre de la rubrique
|
| 752 |
$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
|
764 |
if (!BAZ_UTILISE_TEMPLATE) $res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
|
| 753 |
if (($GLOBALS['_BAZAR_']['condition']!='')AND(!isset($_POST['accept_condition']))AND(!isset($_GET['url'])OR(!isset($_GET['fichier']))OR(!isset($_GET['image'])))) {
|
765 |
if (($GLOBALS['_BAZAR_']['condition']!='')AND(!isset($_POST['accept_condition']))AND(!isset($_GET['url'])OR(!isset($_GET['fichier']))OR(!isset($_GET['image'])))) {
|
| 754 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
|
766 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
|
| 755 |
$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");
|
767 |
$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");
|
| 756 |
$formtemplate->addElement($conditions);
|
768 |
$formtemplate->addElement($conditions);
|
| 757 |
$formtemplate->addElement('checkbox', 'accept_condition',BAZ_ACCEPTE_CONDITIONS) ;
|
769 |
$formtemplate->addElement('checkbox', 'accept_condition',BAZ_ACCEPTE_CONDITIONS) ;
|
| Line 951... |
Line 963... |
| 951 |
}
|
963 |
}
|
| 952 |
// Envoie d un mail aux administrateurs
|
964 |
// Envoie d un mail aux administrateurs
|
| 953 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']);
|
965 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']);
|
| 954 |
if ($utilisateur->isRedacteur($GLOBALS['_BAZAR_']['id_typeannonce'])) {
|
966 |
if ($utilisateur->isRedacteur($GLOBALS['_BAZAR_']['id_typeannonce'])) {
|
| 955 |
$mails = bazar::getMailAdmin($GLOBALS['_BAZAR_']['id_typeannonce']);
|
967 |
$mails = bazar::getMailAdmin($GLOBALS['_BAZAR_']['id_typeannonce']);
|
| - |
|
968 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
| 956 |
$template = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
969 |
$template = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
| 957 |
$sujet = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_SUJET, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
970 |
$sujet = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_SUJET, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
| 958 |
$corps = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_CORPS, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
971 |
$corps = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_CORPS, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
| 959 |
if (is_array ($mails)) {
|
972 |
if (is_array ($mails)) {
|
| 960 |
foreach ($mails as $mail) {
|
973 |
foreach ($mails as $mail) {
|
| Line 1409... |
Line 1422... |
| 1409 |
}
|
1422 |
}
|
| Line 1410... |
Line 1423... |
| 1410 |
|
1423 |
|
| 1411 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1424 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 1412 |
*
|
1425 |
*
|
| - |
|
1426 |
* $Log: bazar.fonct.php,v $
|
| - |
|
1427 |
* Revision 1.69 2007-09-18 07:39:42 alexandre_tb
|
| - |
|
1428 |
* correction d un bug lors d une insertion
|
| - |
|
1429 |
*
|
| - |
|
1430 |
* Revision 1.68 2007-08-27 12:31:31 alexandre_tb
|
| - |
|
1431 |
* mise en place de modele
|
| 1413 |
* $Log: bazar.fonct.php,v $
|
1432 |
*
|
| 1414 |
* Revision 1.67 2007-07-04 10:01:30 alexandre_tb
|
1433 |
* Revision 1.67 2007-07-04 10:01:30 alexandre_tb
|
| 1415 |
* mise en place de divers templates :
|
1434 |
* mise en place de divers templates :
|
| 1416 |
* - mail pour admin (sujet et corps)
|
1435 |
* - mail pour admin (sujet et corps)
|
| 1417 |
* - modele carte_google
|
1436 |
* - modele carte_google
|