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.74.2.5 2008-01-29 09:35:36 alexandre_tb Exp $ |
// CVS : $Id: bazar.fonct.php,v 1.74.2.6 2008-01-29 09:55:07 alexandre_tb 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.74.2.5 $ $Date: 2008-01-29 09:35:36 $ |
*@version $Revision: 1.74.2.6 $ $Date: 2008-01-29 09:55:07 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
1229,92 → 1229,68 |
} |
} |
|
if ($GLOBALS['AUTH']->getAuth()) { |
$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n"; |
//requete pour obtenir l'id et le label des types d'annonces |
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '. |
'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/ |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n"; |
//requete pour obtenir l'id et le label des types d'annonces |
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '. |
'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/ |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
|
// Nettoyage de l url |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR); |
|
$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')); |
$table->addRow(array(BAZ_TYPE_ANNONCES,/* BAZ_STATUT, BAZ_PASSER_EN, */ BAZ_RSS)); |
$table->setRowType(0, 'th'); |
|
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
// Nettoyage de l url |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR); |
$lien_s_abonner=$GLOBALS['_BAZAR_']['url']; |
$lien_s_abonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE); |
$lien_s_abonner->addQueryString('annonce', $ligne['bn_id_nature']); |
$lien_s_abonner->addQueryString('inscrip', 1); |
|
$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')); |
$table->addRow(array(BAZ_TYPE_ANNONCES,/* BAZ_STATUT, BAZ_PASSER_EN, */ BAZ_RSS)); |
$table->setRowType(0, 'th'); |
$lien_se_desabonner=$GLOBALS['_BAZAR_']['url']; |
$lien_se_desabonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE); |
$lien_se_desabonner->addQueryString('annonce', $ligne['bn_id_nature']); |
$lien_se_desabonner->addQueryString('inscrip', 0); |
|
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
/* |
$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ; |
foreach ($tab_parametres_GET as $cle_param => $valeur_param) { |
$tab_valeur = explode ('=', $valeur_param) ; |
$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]); |
} |
*/ |
$lien_s_abonner=$GLOBALS['_BAZAR_']['url']; |
$lien_s_abonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE); |
$lien_s_abonner->addQueryString('annonce', $ligne['bn_id_nature']); |
$lien_s_abonner->addQueryString('inscrip', 1); |
|
$lien_se_desabonner=$GLOBALS['_BAZAR_']['url']; |
$lien_se_desabonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE); |
$lien_se_desabonner->addQueryString('annonce', $ligne['bn_id_nature']); |
$lien_se_desabonner->addQueryString('inscrip', 0); |
|
$lien_RSS=$GLOBALS['_BAZAR_']['url']; |
$lien_RSS->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FLUX_RSS); |
|
//requete pour savoir si la personne est inscrite a ce type d'annonce |
$requete = 'SELECT ba_id_utilisateur '. |
'FROM bazar_abonnement '. |
'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature']; |
$resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat2)) { |
die ($resultat2->getMessage().$resultat2->getDebugInfo()) ; |
} |
if (isset($ligne['bn_image_titre'])) {$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";} |
else {$titre='<strong> '.$ligne['bn_label_nature'].'</strong>'."\n";} |
if ($resultat2->numRows()>0) { |
//$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']); |
$table->addRow(array($titre, |
/* BAZ_ABONNE, |
'<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', */ |
'<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>')); |
$lien_RSS->removeQueryString('annonce'); |
} |
else { |
$lien_RSS->removeQueryString('inscrip'); |
$table->addRow(array($titre, |
/* BAZ_PAS_ABONNE, |
'<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', */ |
'<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>')); |
} |
$lien_RSS=$GLOBALS['_BAZAR_']['url']; |
$lien_RSS->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FLUX_RSS); |
|
//requete pour savoir si la personne est inscrite a ce type d'annonce |
$requete = 'SELECT ba_id_utilisateur '. |
'FROM bazar_abonnement '. |
'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature']; |
$resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat2)) { |
die ($resultat2->getMessage().$resultat2->getDebugInfo()) ; |
} |
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')); |
$table->updateColAttributes(0, array('class' => 'col1')); |
$table->updateColAttributes(1, array('class' => 'col2')); |
$res.=$table->toHTML() ; |
if (isset($ligne['bn_image_titre'])) {$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";} |
else {$titre='<strong> '.$ligne['bn_label_nature'].'</strong>'."\n";} |
if ($resultat2->numRows()>0) { |
//$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']); |
$table->addRow(array($titre, |
/* BAZ_ABONNE, |
'<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', */ |
'<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>')); |
$lien_RSS->removeQueryString('annonce'); |
} |
else { |
$lien_RSS->removeQueryString('inscrip'); |
$table->addRow(array($titre, |
/* BAZ_PAS_ABONNE, |
'<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', */ |
'<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>')); |
} |
} |
else { |
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ; |
$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ; |
$GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE); |
$res .= $GLOBALS['_BAZAR_']['url']->getURL(); |
$res .= '" method="post"> |
<fieldset> |
<legend>Identifiez vous</legend> |
<label for="username">Courriel : </label> |
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" /> |
<label for="password">Mot de passe : </label> |
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" /> |
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" /> |
</fieldset> |
</form>'; |
} |
|
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')); |
$table->updateColAttributes(0, array('class' => 'col1')); |
$table->updateColAttributes(1, array('class' => 'col2')); |
$res.=$table->toHTML() ; |
|
// Nettoyage de l'url |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); |
$GLOBALS['_BAZAR_']['url']->removeQueryString('idtypeannonce'); |
1407,6 → 1383,11 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.74.2.5 2008-01-29 09:35:36 alexandre_tb |
* remplacement des variables action par une constante |
* Utilisation d un redirection pour eviter que les formulaires soient valides 2 fois |
* simplification de la suppression d un lien associe a une liste |
* |
* Revision 1.74.2.4 2008-01-11 14:10:12 alexandre_tb |
* Remplacement de la variable action ecrite en dur par la constante BAZ_VARIABLE_ACTION |
* |