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.66 2007-06-25 12:15:06 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.php,v 1.67 2007-07-04 10:01:30 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.66 $ $Date: 2007-06-25 12:15:06 $
|
34 |
*@version $Revision: 1.67 $ $Date: 2007-07-04 10:01:30 $
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
*/
|
36 |
*/
|
Line 37... |
Line 37... |
37 |
|
37 |
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
Line 79... |
Line 79... |
79 |
* @return string HTML
|
79 |
* @return string HTML
|
80 |
*/
|
80 |
*/
|
81 |
function fiches_a_valider() {
|
81 |
function fiches_a_valider() {
|
82 |
// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
|
82 |
// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
|
83 |
// On effectue une requete sur le bazar pour voir les fiches a administrer
|
83 |
// On effectue une requete sur le bazar pour voir les fiches a administrer
|
- |
|
84 |
$GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_ADMIN);
|
84 |
$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2><br />'."\n";
|
85 |
$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2><br />'."\n";
|
- |
|
86 |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND ' .
|
85 |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bf_date_maj_fiche DESC' ;
|
87 |
'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ' .
|
- |
|
88 |
'ORDER BY bf_date_maj_fiche DESC' ;
|
86 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
89 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
87 |
if (DB::isError($resultat)) {
|
90 |
if (DB::isError($resultat)) {
|
88 |
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
91 |
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
89 |
}
|
92 |
}
|
90 |
if ($resultat->numRows() != 0) {
|
93 |
if ($resultat->numRows() != 0) {
|
Line 94... |
Line 97... |
94 |
$table->addRow($entete) ;
|
97 |
$table->addRow($entete) ;
|
95 |
$table->setRowType (0, 'th') ;
|
98 |
$table->setRowType (0, 'th') ;
|
Line 96... |
Line 99... |
96 |
|
99 |
|
97 |
// On affiche une ligne par proposition
|
100 |
// On affiche une ligne par proposition
|
98 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
|
101 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
|
99 |
//Requete pour trouver le nom et prénom de l'annonceur
|
102 |
//Requete pour trouver le nom et prenom de l'annonceur
|
100 |
$requetenomprenom = 'SELECT '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_NOM.' FROM '.BAZ_ANNUAIRE.
|
103 |
$requetenomprenom = 'SELECT '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_NOM.' FROM '.BAZ_ANNUAIRE.
|
101 |
' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'] ;
|
104 |
' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'] ;
|
102 |
$resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query ($requetenomprenom) ;
|
105 |
$resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query ($requetenomprenom) ;
|
103 |
if (DB::isError($resultatnomprenom)) {
|
106 |
if (DB::isError($resultatnomprenom)) {
|
Line 159... |
Line 162... |
159 |
}
|
162 |
}
|
160 |
else {
|
163 |
else {
|
161 |
$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" ;
|
162 |
}
|
165 |
}
|
163 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
|
166 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
|
- |
|
167 |
|
164 |
$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>';
|
Line 165... |
Line 169... |
165 |
|
169 |
|
166 |
// Nettoyage de l'url
|
170 |
// Nettoyage de l'url
|
167 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
171 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
168 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
172 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
- |
|
173 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
|
- |
|
174 |
|
- |
|
175 |
// Les autres fiches, deja validees
|
- |
|
176 |
$res .= '<h2>'.BAZ_TOUTES_LES_FICHES.'</h2>'."\n";
|
- |
|
177 |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=1 AND ' .
|
- |
|
178 |
'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ' .
|
- |
|
179 |
'ORDER BY bf_date_maj_fiche DESC' ;
|
- |
|
180 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
181 |
if (DB::isError($resultat)) {
|
- |
|
182 |
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
- |
|
183 |
}
|
- |
|
184 |
if ($resultat->numRows() != 0) {
|
- |
|
185 |
$tableAttr = array('id' => 'table_bazar') ;
|
- |
|
186 |
$table = new HTML_Table($tableAttr) ;
|
- |
|
187 |
$entete = array (BAZ_TITREANNONCE ,BAZ_ANNONCEUR, BAZ_TYPEANNONCE, BAZ_PUBLIER, BAZ_SUPPRIMER) ;
|
- |
|
188 |
$table->addRow($entete) ;
|
- |
|
189 |
$table->setRowType (0, 'th') ;
|
- |
|
190 |
|
- |
|
191 |
// On affiche une ligne par proposition
|
- |
|
192 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
|
- |
|
193 |
//Requete pour trouver le nom et prenom de l'annonceur
|
- |
|
194 |
$requetenomprenom = 'SELECT '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_NOM.' FROM '.BAZ_ANNUAIRE.
|
- |
|
195 |
' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'] ;
|
- |
|
196 |
$resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query ($requetenomprenom) ;
|
- |
|
197 |
if (DB::isError($resultatnomprenom)) {
|
- |
|
198 |
echo ("Echec de la requete<br />".$resultatnomprenom->getMessage()."<br />".$resultatnomprenom->getDebugInfo()) ;
|
- |
|
199 |
}
|
- |
|
200 |
while ($lignenomprenom = $resultatnomprenom->fetchRow (DB_FETCHMODE_ASSOC)) {
|
- |
|
201 |
$annonceur=$lignenomprenom[BAZ_CHAMPS_PRENOM]." ".$lignenomprenom[BAZ_CHAMPS_NOM];
|
- |
|
202 |
}
|
- |
|
203 |
$lien_voir=$GLOBALS['_BAZAR_']['url'];
|
- |
|
204 |
$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
|
- |
|
205 |
$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
- |
|
206 |
$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']);
|
- |
|
207 |
|
- |
|
208 |
// Nettoyage de l'url
|
- |
|
209 |
// NOTE (jpm - 23 mai 2007): pour être compatible avec PHP5 il faut utiliser tjrs $GLOBALS['_BAZAR_']['url'] car en php4 on
|
- |
|
210 |
// copie bien une variable mais pas en php5, cela reste une référence...
|
- |
|
211 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
212 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
- |
|
213 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
|
- |
|
214 |
|
- |
|
215 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
- |
|
216 |
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $ligne['bn_id_nature']);
|
- |
|
217 |
|
- |
|
218 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
|
- |
|
219 |
$lien_voir = $GLOBALS['_BAZAR_']['url']->getURL();
|
Line -... |
Line 220... |
- |
|
220 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
221 |
|
- |
|
222 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_PUBLIER);
|
- |
|
223 |
$lien_publie_oui = $GLOBALS['_BAZAR_']['url']->getURL();
|
- |
|
224 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
225 |
|
- |
|
226 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_PAS_PUBLIER);
|
- |
|
227 |
$lien_publie_non = $GLOBALS['_BAZAR_']['url']->getURL();
|
- |
|
228 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
229 |
|
- |
|
230 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
|
- |
|
231 |
$lien_supprimer = $GLOBALS['_BAZAR_']['url']->getURL();
|
- |
|
232 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
233 |
|
- |
|
234 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
|
- |
|
235 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
|
- |
|
236 |
|
- |
|
237 |
$table->addRow (array(
|
- |
|
238 |
'<a href="'.$lien_voir.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom
|
- |
|
239 |
$annonceur."\n", // col 2 : annonceur
|
- |
|
240 |
$ligne['bn_label_nature']."\n", // col 3 : type annonce
|
- |
|
241 |
"<a href=\"".$lien_publie_oui."\">".BAZ_OUI."</a> / \n".
|
- |
|
242 |
"<a href=\"".$lien_publie_non."\">".BAZ_NON."</a>", // col 4 : publier ou pas
|
- |
|
243 |
"<a href=\"".$lien_supprimer."\"".
|
- |
|
244 |
" onclick=\"javascript:return confirm('".BAZ_CONFIRMATION_SUPPRESSION."');\">".BAZ_SUPPRIMER."</a>\n")) ; // col 5 : supprimer
|
- |
|
245 |
|
- |
|
246 |
}
|
- |
|
247 |
$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
|
- |
|
248 |
$table->updateColAttributes(1, array("align" => "center"));
|
- |
|
249 |
$table->updateColAttributes(2, array("align" => "center"));
|
- |
|
250 |
$table->updateColAttributes(3, array("align" => "center"));
|
- |
|
251 |
$table->updateColAttributes(4, array("align" => "center"));
|
- |
|
252 |
$res .= $table->toHTML() ;
|
169 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
|
253 |
}
|
170 |
|
254 |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR);
|
Line 171... |
Line 255... |
171 |
return $res;
|
255 |
return $res;
|
Line 414... |
Line 498... |
414 |
}
|
498 |
}
|
415 |
if ($utilisateur->isAdmin($ligne['bn_id_nature'])) {
|
499 |
if ($utilisateur->isAdmin($ligne['bn_id_nature'])) {
|
416 |
$table->addRow(array($titre,
|
500 |
$table->addRow(array($titre,
|
417 |
BAZ_DROIT_ADMIN,
|
501 |
BAZ_DROIT_ADMIN,
|
418 |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
|
502 |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
|
419 |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>'));
|
503 |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_LABEL_REDACTEUR.'</a>'));
|
420 |
}
|
504 |
}
|
421 |
elseif ($utilisateur->isRedacteur($ligne['bn_id_nature'])) {
|
505 |
elseif ($utilisateur->isRedacteur($ligne['bn_id_nature'])) {
|
422 |
$table->addRow(array($titre,
|
506 |
$table->addRow(array($titre,
|
423 |
BAZ_DROIT_REDACTEUR,
|
507 |
BAZ_LABEL_REDACTEUR,
|
424 |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
|
508 |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
|
425 |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
|
509 |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
|
426 |
}
|
510 |
}
|
427 |
else {
|
511 |
else {
|
428 |
$table->addRow(array($titre,
|
512 |
$table->addRow(array($titre,
|
429 |
BAZ_AUCUN_DROIT,
|
513 |
BAZ_AUCUN_DROIT,
|
430 |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>',
|
514 |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_LABEL_REDACTEUR.'</a>',
|
431 |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
|
515 |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
|
Line 432... |
Line 516... |
432 |
|
516 |
|
433 |
}
|
517 |
}
|
Line 494... |
Line 578... |
494 |
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace ('/&/', '&', $lien_formulaire->getURL()) );
|
578 |
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace ('/&/', '&', $lien_formulaire->getURL()) );
|
495 |
$squelette =& $formtemplate->defaultRenderer();
|
579 |
$squelette =& $formtemplate->defaultRenderer();
|
496 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
|
580 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
|
497 |
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
|
581 |
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
|
498 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
582 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
499 |
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
|
583 |
' </td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
|
500 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
584 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
501 |
'</td>'."\n".'</tr>'."\n");
|
585 |
'</td>'."\n".'</tr>'."\n");
|
502 |
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label} {element}</strong>'."\n".
|
586 |
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label} {element}</strong>'."\n".
|
503 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
|
587 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
|
504 |
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
|
588 |
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
|
Line 515... |
Line 599... |
515 |
$res = '';
|
599 |
$res = '';
|
516 |
//requete pour obtenir le nom et la description des types d'annonce
|
600 |
//requete pour obtenir le nom et la description des types d'annonce
|
517 |
$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
|
601 |
$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
|
518 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
602 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
519 |
if (DB::isError($resultat)) {
|
603 |
if (DB::isError($resultat)) {
|
520 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
604 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
521 |
}
|
605 |
}
|
522 |
$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
606 |
$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
523 |
if ($resultat->numRows()==1) {
|
607 |
if ($resultat->numRows()==1) {
|
524 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
608 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
525 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
609 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
Line 553... |
Line 637... |
553 |
}
|
637 |
}
|
554 |
$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
|
638 |
$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
|
Line 555... |
Line 639... |
555 |
|
639 |
|
556 |
//Mettre les annonces en choix par defaut
|
640 |
//Mettre les annonces en choix par defaut
|
557 |
$formtemplate->setdefaults(array('typeannonce'=>'1'));
|
641 |
$formtemplate->setdefaults(array('typeannonce'=>'1'));
|
558 |
|
642 |
|
- |
|
643 |
// Bouton d annulation
|
- |
|
644 |
$lien_formulaire->removeQueryString('action');
|
- |
|
645 |
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', BAZ_ANNULER,
|
- |
|
646 |
preg_replace ("/&/", "&", $lien_formulaire->getURL()), BAZ_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
|
- |
|
647 |
// qui remplacent deux fois les & par des &
|
559 |
//Bouton de validation du formulaire
|
648 |
//Bouton de validation du formulaire // ce qui fait échouer le lien
|
- |
|
649 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', BAZ_VALIDER);
|
Line 560... |
Line 650... |
560 |
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
|
650 |
$formtemplate->addGroup($buttons, null, null, ' ');
|
561 |
|
651 |
|
562 |
//Affichage a l'ecran
|
652 |
//Affichage a l'ecran
|
563 |
$res.= $formtemplate->toHTML()."\n";
|
653 |
$res.= $formtemplate->toHTML()."\n";
|
Line 606... |
Line 696... |
606 |
return ;
|
696 |
return ;
|
607 |
}
|
697 |
}
|
608 |
}
|
698 |
}
|
609 |
}
|
699 |
}
|
610 |
else {
|
700 |
else {
|
- |
|
701 |
/*
|
611 |
$res .= '<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2><br />'."\n";
|
702 |
$res .= '<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2><br />'."\n";
|
612 |
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
|
703 |
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
|
613 |
$res .= '<form id="form_connexion" class="form_identification" action="' ;
|
704 |
$res .= '<form id="form_connexion" class="form_identification" action="' ;
|
614 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
|
705 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
|
615 |
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
|
706 |
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
|
Line 620... |
Line 711... |
620 |
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
|
711 |
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
|
621 |
<label for="password">Mot de passe : </label>
|
712 |
<label for="password">Mot de passe : </label>
|
622 |
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
|
713 |
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
|
623 |
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
|
714 |
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
|
624 |
</fieldset>
|
715 |
</fieldset>
|
625 |
</form>';
|
716 |
</form>';*/
|
- |
|
717 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
- |
|
718 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
- |
|
719 |
$res .= $modele->getTemplate(BAZ_TEMPLATE_MESSAGE_LOGIN, $GLOBALS['_BAZAR_']['langue']);
|
626 |
}
|
720 |
}
|
Line 627... |
Line 721... |
627 |
|
721 |
|
628 |
return $res;
|
722 |
return $res;
|
Line 668... |
Line 762... |
668 |
//Parcours du fichier de templates, pour mettre les valeurs des champs
|
762 |
//Parcours du fichier de templates, pour mettre les valeurs des champs
|
669 |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
763 |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
670 |
if ($mode=='modification') {
|
764 |
if ($mode=='modification') {
|
671 |
//Ajout des valeurs par defaut
|
765 |
//Ajout des valeurs par defaut
|
672 |
$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
|
766 |
$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
|
- |
|
767 |
|
673 |
for ($i=0; $i<count($tableau); $i++) {
|
768 |
for ($i=0; $i<count($tableau); $i++) {
|
674 |
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
769 |
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
675 |
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
|
770 |
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
|
676 |
}
|
771 |
}
|
677 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
772 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='champs_cache') {
|
678 |
$def=$tableau[$i]['nom_bdd'];
|
773 |
$def=$tableau[$i]['nom_bdd'];
|
679 |
} elseif ($tableau[$i]['type']=='carte_google') {
|
774 |
} elseif ($tableau[$i]['type']=='carte_google') {
|
680 |
$def = 'carte_google';
|
775 |
$def = 'carte_google';
|
681 |
$valeurs_par_defaut[$def] = array ('latitude' => $valeurs_par_defaut['bf_latitude'], 'longitude' => $valeurs_par_defaut['bf_longitude']);
|
776 |
$valeurs_par_defaut[$def] = array ('latitude' => $valeurs_par_defaut['bf_latitude'], 'longitude' => $valeurs_par_defaut['bf_longitude']);
|
682 |
}
|
777 |
}
|
683 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
778 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
684 |
$tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
779 |
$tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
- |
|
780 |
if ($tableau[$i]['type']=='carte_google') {
|
- |
|
781 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
- |
|
782 |
GEN_stockerCodeScript($script);
|
- |
|
783 |
}
|
685 |
}
|
784 |
}
|
686 |
}
|
785 |
}
|
687 |
else {
|
786 |
else {
|
688 |
for ($i=0; $i<count($tableau); $i++) {
|
787 |
for ($i=0; $i<count($tableau); $i++) {
|
689 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
788 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
690 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
789 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
|
- |
|
790 |
if ($tableau[$i]['type'] == 'carte_google') {
|
- |
|
791 |
include_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.google.php';
|
- |
|
792 |
GEN_stockerCodeScript($script);
|
- |
|
793 |
}
|
691 |
}
|
794 |
}
|
692 |
}
|
795 |
}
|
693 |
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
|
796 |
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
|
- |
|
797 |
|
- |
|
798 |
// Bouton d annulation
|
- |
|
799 |
$attr = $formtemplate->getAttributes();
|
- |
|
800 |
$lien_formulaire = new Net_URL($attr['action']);
|
- |
|
801 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
|
- |
|
802 |
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', BAZ_ANNULER,
|
- |
|
803 |
preg_replace ("/&/", "&", $lien_formulaire->getURL()), BAZ_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
|
- |
|
804 |
// qui remplacent deux fois les & par des &
|
- |
|
805 |
//Bouton de validation du formulaire // ce qui fait échouer le lien
|
694 |
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
|
806 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', BAZ_VALIDER);
|
- |
|
807 |
$formtemplate->addGroup($buttons, null, null, ' ');
|
- |
|
808 |
|
695 |
}
|
809 |
}
|
Line 696... |
Line 810... |
696 |
|
810 |
|
697 |
//Affichage a l'ecran
|
811 |
//Affichage a l'ecran
|
698 |
$res .= $formtemplate->toHTML()."\n";
|
812 |
$res .= $formtemplate->toHTML()."\n";
|
Line 783... |
Line 897... |
783 |
$val = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
|
897 |
$val = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
|
784 |
}
|
898 |
}
|
785 |
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
|
899 |
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
|
786 |
}
|
900 |
}
|
787 |
//cas des champs texte
|
901 |
//cas des champs texte
|
788 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) {
|
902 |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='champs_cache' ) {
|
789 |
//on mets les slashes pour les saisies dans les champs texte et textearea
|
903 |
//on mets les slashes pour les saisies dans les champs texte et textearea
|
790 |
$val=addslashes($valeur[$tableau[$i]['nom_bdd']]) ;
|
904 |
$val=addslashes($valeur[$tableau[$i]['nom_bdd']]) ;
|
791 |
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
|
905 |
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
|
792 |
}
|
906 |
}
|
793 |
//cas des wikinis
|
907 |
//cas des wikinis
|
Line 829... |
Line 943... |
829 |
$requete .= 'bf_date_debut_validite_fiche=now(), bf_date_fin_validite_fiche="0000-00-00", ' ;
|
943 |
$requete .= 'bf_date_debut_validite_fiche=now(), bf_date_fin_validite_fiche="0000-00-00", ' ;
|
830 |
}
|
944 |
}
|
831 |
$requete .=requete_bazar_fiche(&$valeur) ;
|
945 |
$requete .=requete_bazar_fiche(&$valeur) ;
|
832 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
946 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
833 |
if (DB::isError($resultat)) {
|
947 |
if (DB::isError($resultat)) {
|
834 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
948 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
- |
|
949 |
}
|
- |
|
950 |
// Envoie d un mail aux administrateurs
|
- |
|
951 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']);
|
- |
|
952 |
if ($utilisateur->isRedacteur($GLOBALS['_BAZAR_']['id_typeannonce'])) {
|
- |
|
953 |
$mails = bazar::getMailAdmin($GLOBALS['_BAZAR_']['id_typeannonce']);
|
- |
|
954 |
$template = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
- |
|
955 |
$sujet = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_SUJET, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
- |
|
956 |
$corps = $template->getTemplate(BAZ_TEMPLATE_MAIL_NOUVELLE_FICHE_CORPS, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['id_typeannonce']);
|
- |
|
957 |
if (is_array ($mails)) {
|
- |
|
958 |
foreach ($mails as $mail) {
|
- |
|
959 |
mail ($mail, $sujet, $corps);
|
- |
|
960 |
}
|
- |
|
961 |
}
|
835 |
}
|
962 |
}
|
836 |
return;
|
963 |
return;
|
837 |
}
|
964 |
}
|
Line 1228... |
Line 1355... |
1228 |
$val .= $result[0];
|
1355 |
$val .= $result[0];
|
1229 |
$nb++;
|
1356 |
$nb++;
|
1230 |
}
|
1357 |
}
|
1231 |
$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val;
|
1358 |
$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val;
|
1232 |
}
|
1359 |
}
|
1233 |
elseif ($tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin') {
|
1360 |
elseif ($tableau[$i]['type']=='champs_cache' || $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin') {
|
1234 |
$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]);
|
1361 |
$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]);
|
1235 |
} elseif ($tableau[$i]['type']=='carte_google') {
|
1362 |
} elseif ($tableau[$i]['type']=='carte_google') {
|
1236 |
$valeurs_fiche['bf_latitude'] = $ligne['bf_latitude'];
|
1363 |
$valeurs_fiche['bf_latitude'] = $ligne['bf_latitude'];
|
1237 |
$valeurs_fiche['bf_longitude'] = $ligne['bf_longitude'];
|
1364 |
$valeurs_fiche['bf_longitude'] = $ligne['bf_longitude'];
|
1238 |
}
|
1365 |
}
|
1239 |
}
|
1366 |
}
|
1240 |
return $valeurs_fiche;
|
1367 |
return $valeurs_fiche;
|
1241 |
}
|
1368 |
}
|
Line 1242... |
Line -... |
1242 |
|
- |
|
1243 |
|
- |
|
1244 |
function baz_envoie_mail() {
|
- |
|
1245 |
$headers['From'] = $_SERVER['SERVER_ADMIN'] ;
|
- |
|
1246 |
$headers['To'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
|
- |
|
1247 |
$headers['Subject'] = INS_MAIL_ADMIN_APRES_INSCRIPTION_SUJET;
|
- |
|
1248 |
|
- |
|
1249 |
$q = "select * from ".INS_ANNUAIRE." where ".INS_CHAMPS_MAIL."=\"".$_POST['mail']."\"" ;
|
- |
|
1250 |
|
- |
|
1251 |
$r = $GLOBALS['_BAZAR_']['db']->query($q) ;
|
- |
|
1252 |
if (DB::isError ($r)) {
|
- |
|
1253 |
die ("echec de la requete") ;
|
- |
|
1254 |
}
|
- |
|
1255 |
$row = $r->fetchRow(DB_FETCHMODE_ASSOC) ;
|
- |
|
1256 |
|
- |
|
1257 |
$body_entete = "Un nouvel inscrit à tela : \n" ;
|
- |
|
1258 |
$body = "mail : ".$row[INS_CHAMPS_MAIL]."\n" ;
|
- |
|
1259 |
$body .= "------------------------------------------\n";
|
- |
|
1260 |
$body .= "nom: ".unhtmlentities($row[INS_CHAMPS_NOM])." \n" ;
|
- |
|
1261 |
$body .= "prénom : ".unhtmlentities($row[INS_CHAMPS_PRENOM])." \n" ;
|
- |
|
1262 |
$body .= "-------------------------------------------\n" ;
|
- |
|
1263 |
|
- |
|
1264 |
// création du mail
|
- |
|
1265 |
$mail_object =& Mail::factory('mail');
|
- |
|
1266 |
if (!mail ($headers['To'], $headers['Subject'], $body)) {
|
- |
|
1267 |
return "Une erreur s'est produite:<br />\n" ;
|
- |
|
1268 |
}
|
- |
|
1269 |
$body .= INS_MAIL_INSCRIPTION_2;
|
- |
|
1270 |
|
- |
|
1271 |
$headers['To'] = $_POST['mail'] ;
|
- |
|
1272 |
|
- |
|
1273 |
// création du mail
|
- |
|
1274 |
if (mail($headers['To'], $headers['Subject'], INS_MAIL_INSCRIPTION_1.$body)) {
|
- |
|
1275 |
return "Une erreur s'est produite<br />\n" ;
|
- |
|
1276 |
}
|
- |
|
1277 |
return;
|
- |
|
1278 |
}
|
- |
|
1279 |
|
- |
|
1280 |
|
1369 |
|
1281 |
/** function baz_nextId () Renvoie le prochain identifiant numerique libre d'une table
|
1370 |
/** function baz_nextId () Renvoie le prochain identifiant numerique libre d'une table
|
1282 |
*
|
1371 |
*
|
1283 |
* @param string Nom de la table
|
1372 |
* @param string Nom de la table
|
1284 |
* @param string Nom du champs identifiant
|
1373 |
* @param string Nom du champs identifiant
|
Line 1318... |
Line 1407... |
1318 |
}
|
1407 |
}
|
Line 1319... |
Line 1408... |
1319 |
|
1408 |
|
1320 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1409 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1321 |
*
|
1410 |
*
|
- |
|
1411 |
* $Log: not supported by cvs2svn $
|
- |
|
1412 |
* Revision 1.66 2007-06-25 12:15:06 alexandre_tb
|
- |
|
1413 |
* merge from narmer
|
1322 |
* $Log: not supported by cvs2svn $
|
1414 |
*
|
1323 |
* Revision 1.65 2007-06-25 08:31:17 alexandre_tb
|
1415 |
* Revision 1.65 2007-06-25 08:31:17 alexandre_tb
|
1324 |
* utilisation de la bibliotheque generale api/formulaire/formulaire.fonct.inc.php a la place de bazar.fonct.formulaire.php
|
1416 |
* utilisation de la bibliotheque generale api/formulaire/formulaire.fonct.inc.php a la place de bazar.fonct.formulaire.php
|
1325 |
*
|
1417 |
*
|
1326 |
* Revision 1.64 2007-06-04 15:25:39 alexandre_tb
|
1418 |
* Revision 1.64 2007-06-04 15:25:39 alexandre_tb
|