19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: bazar.fonct.php,v 1.35 2006-01-18 11:06:51 florian Exp $ |
// CVS : $Id: bazar.fonct.php,v 1.36 2006-01-19 17:42:11 florian Exp $ |
/** |
* |
* Fonctions du module bazar |
31,7 → 31,7 |
*@author Florian Schmitt <florian@ecole-et-nature.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.35 $ $Date: 2006-01-18 11:06:51 $ |
*@version $Revision: 1.36 $ $Date: 2006-01-19 17:42:11 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
569,24 → 569,34 |
} |
//affichage du formulaire si conditions acceptées |
else { |
//Parcours du fichier de templates, pour mettre les champs specifiques |
|
//Parcours du fichier de templates, pour mettre les champs specifiques |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']); |
for ($i=0; $i<count($tableau); $i++) { |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ; |
if ($mode=='modification') { |
//Ajout des valeurs par defaut |
$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ; |
for ($i=0; $i<count($tableau); $i++) { |
if (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='checkbox')) { |
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd']; |
} |
else { |
$def=$tableau[$i]['nom_bdd']; |
} |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
$tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ; |
} |
} |
|
else { |
for ($i=0; $i<count($tableau); $i++) { |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ; |
} |
} |
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']); |
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER); |
|
if ($mode=='modification') { |
//initialisation de la variable globale id_fiche |
$GLOBALS['_BAZAR_']['id_fiche'] = $_REQUEST['id_fiche']; |
|
//Ajout des valeurs par defaut |
$formtemplate->setDefaults(baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche'])) ; |
|
$GLOBALS['_BAZAR_']['id_fiche'] = $_REQUEST['id_fiche']; |
//preparation des formulaires supplementaires |
//AJOUTER UNE IMAGE |
$lien_formulaire=$GLOBALS['_BAZAR_']['url']; |
1194,103 → 1204,30 |
$tableau = baz_valeurs_template($GLOBALS['_BAZAR_']['template']); |
for ($i=0; $i<count($tableau); $i++) { |
if ($tableau[$i]['type']!='labelhtml') { |
$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]); |
} |
if (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='checkbox')) { |
$requete = 'SELECT bfvl_valeur FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$idfiche. |
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError ($resultat)) { |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
} |
$nb=0;$val=''; |
while ($result = $resultat->fetchRow()) { |
if ($nb>0) $val .= ', '; |
$val .= $result[0]; |
$nb++; |
} |
$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val; |
} |
else { |
$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]); |
} |
} |
} |
return $valeurs_fiche; |
} |
|
|
/** baz_rechercher() affiche le formulaire de recherche d'annonces |
* |
* @return string le code HTML à afficher |
*/ |
//function baz_rechercher() { |
// $res= '<h2>'.BAZ_RECHERCHER_DES_ANNONCES.'</h2>'."\n"; |
// |
// $GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_RECHERCHER_ANNONCE); |
// $lien_formulaire=preg_replace ('/&/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ; |
// $formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ; |
// |
// //requete pour obtenir l'id et le label des types d'annonces |
// $requete = 'SELECT bn_label_nature '. |
// 'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu. |
// ' or bn_ce_id_menu=0 ORDER BY bn_label_nature ASC'; |
// $resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
// if (DB::isError($resultat)) { |
// die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
// } |
// $type_annonce_select['toutes']=BAZ_TOUTES; |
// while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
// $type_annonce_select[$ligne['bn_label_nature']] = $ligne['bn_label_nature']; |
// } |
// $option=array('style'=>'width: 195px;', 'onchange'=>'this.form.submit();'); |
// $formtemplate->addElement ('select', 'type_annonce', BAZ_TYPEANNONCE, $type_annonce_select, $option) ; |
// |
// //requete pour obtenir l'id, le nom et prénom de toutes les personnes ayant une fiche publiée actuellement |
// $requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '. |
// 'FROM bazar_fiche,'.BAZ_ANNUAIRE.' '. |
// 'WHERE bf_statut_fiche=1 AND bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() AND bf_ce_utilisateur='.BAZ_CHAMPS_ID.' '. |
// 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC'; |
// $resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
// if (DB::isError($resultat)) { |
// die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
// } |
// $personnes_select['tous']=BAZ_TOUS; |
// while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
// $personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ; |
// } |
// $option=array('style'=>'width: 195px;', 'onchange'=>'this.form.submit();'); |
// $formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ; |
// |
// //champs texte pour entrer les mots clés |
// $option=array('size'=>30,'maxlength'=>40); |
// $formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ; |
// //Bouton de validation du formulaire |
// $bouton[] = &HTML_QuickForm::createElement('submit', 'valider', BAZ_VALIDER); |
// $formtemplate->addGroup($bouton, null, null, ''); |
// |
// $requeteSQL=''; |
// //affichage des résultats de la recherche si le formulaire a été envoyé |
// if (isset($_POST['type_annonce'])) { |
// //ajout des champs pour la recherche personnalisée |
// if ($_POST['type_annonce']!='toutes') { |
// $tableau=baz_valeurs_template($_POST['type_annonce'].'.tpl'); |
// $nbvaleurs=count($tableau); |
// $html='<h3>'.BAZ_RECHERCHE_AVANCEE.'</h3>'."\n"; |
// $formtemplate->addElement('html', $html) ; |
// for ($i=0; $i<$nbvaleurs; $i++) { |
// if (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='listedatedeb')or($tableau[$i]['type']=='listedatefin')) { |
// $tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
// $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], 0) ; |
// } |
// } |
// } |
// $res.= $formtemplate->toHTML() ; |
// |
// //préparation de la requête pour trouver les mots clés |
// if ($_POST['recherche_mots_cles']!='') { |
// //découpage des mots clés |
// $recherche = split(' ', $_POST['recherche_mots_cles']) ; |
// $nbmots=count($recherche); |
// for ($i=0; $i<$nbmots; $i++) { |
// if ($i>0) $requeteSQL.=' OR '; |
// $requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" '; |
// } |
// } |
// |
// //génération de l'affichage |
// $res.=RSSversHTML(gen_RSS($_POST['type_annonce'], '', $_POST['personnes'], 1, $requeteSQL), 1, 'jm') ; |
// } |
// else { |
// //Bouton de validation du formulaire |
// $res.=$formtemplate->toHTML()."\n".BAZ_DESCRIPTION_RECHERCHE; |
// } |
// |
// return $res; |
//} |
|
|
function baz_envoie_mail() { |
$headers['From'] = $_SERVER['SERVER_ADMIN'] ; |
$headers['To'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ; |
1328,13 → 1265,13 |
} |
|
|
/** function baz_nextId () Renvoie le prochain identifiant numérique libre d'une table |
/** function baz_nextId () Renvoie le prochain identifiant numerique libre d'une table |
* |
* @param string Nom de la table |
* @param string Nom du champs identifiant |
* @param mixed Objet DB de PEAR pour la connexion à la base de donnée |
* @param mixed Objet DB de PEAR pour la connexion a la base de donnees |
* |
* return integer Le prochain numéro d'identifiant disponible |
* return integer Le prochain numero d'identifiant disponible |
*/ |
function baz_nextId($table, $colonne_identifiant, $bdd) { |
$requete = 'SELECT MAX('.$colonne_identifiant.') AS maxi FROM '.$table; |
1354,6 → 1291,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.35 2006/01/18 11:06:51 florian |
* correction erreur saisie date |
* |
* Revision 1.34 2006/01/18 10:53:28 florian |
* corrections bugs affichage fiche |
* |