Subversion Repositories Applications.bazar

Rev

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

Rev 340 Rev 341
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.rss.php,v 1.99.2.2 2007-11-30 15:02:50 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.99.2.3 2007-12-03 15:16:21 jp_milcent Exp $
23
/**
23
/**
24
* 
24
* 
25
*@package bazar
25
*@package bazar
26
//Auteur original :
26
//Auteur original :
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
29
//Autres auteurs :
29
//Autres auteurs :
30
*@copyright     Tela-Botanica 2000-2006
30
*@copyright     Tela-Botanica 2000-2006
31
*@version       $Revision: 1.99.2.2 $
31
*@version       $Revision: 1.99.2.3 $
32
// +------------------------------------------------------------------------------------------------------+
32
// +------------------------------------------------------------------------------------------------------+
33
*/
33
*/
Line 34... Line 34...
34
 
34
 
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
Line 394... Line 394...
394
		}
394
		}
395
		$res .= '</div>'."\n";
395
		$res .= '</div>'."\n";
396
		$res .= '</div>'."\n";
396
		$res .= '</div>'."\n";
397
	}
397
	}
Line 398... Line 398...
398
 
398
 
-
 
399
	// Nous vérifions comment est appelé la fonction
399
	// ATTENTION : vérifier que le div ci-dessous est bien inutile dans tous les cas! Il n'y a pas dans cette fonction de div ouvrant correspondant.
400
	if ($danslappli == 0) {
-
 
401
	 $res .= '</div>'."\n";
400
	// $res .= '</div>'."\n";
402
	} else if ($danslappli == 1 ) {
401
	
403
 
402
	//on ajoute les appropriations, s'il le faut
404
		// Ajout des appropriations, s'il le faut
403
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
405
		if ($GLOBALS['_BAZAR_']['appropriation'] == 1) {
404
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
406
			$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
405
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";		
407
			$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";		
406
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
408
			$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
407
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
409
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
408
		if (DB::isError ($resultat)) {
410
			if (DB::isError ($resultat)) {
409
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
411
				return $resultat->getMessage().'<br />'.$resultat->getDebugInfo();
410
		}
412
			}
411
		$possede_ressource=0;
413
			$possede_ressource=0;
412
		if ($resultat->numRows()>0) {
414
			if ($resultat->numRows()>0) {
413
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
415
				$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
414
			if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
416
				if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
415
			else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
417
				else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
416
			$res .= '<ul>'."\n";
418
				$res .= '<ul>'."\n";
417
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
419
				while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
418
				$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
420
					$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
419
				if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
-
 
420
			}
-
 
421
			$res .= '</ul><br />'."\n";
-
 
422
		}
-
 
423
		else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
-
 
424
		$res .='<p class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
425
		$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
-
 
426
		$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
-
 
427
		$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);			
-
 
428
		if ($possede_ressource) {
-
 
429
			$lien_appropriation->addQueryString('appropriation', 0);
-
 
430
			$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
-
 
431
			$lien_appropriation->removeQueryString('appropriation');
-
 
432
		}
-
 
433
		elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
434
			$lien_appropriation->addQueryString('appropriation', 1);
-
 
435
			$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
-
 
436
			$lien_appropriation->removeQueryString('appropriation');
-
 
437
		}
-
 
438
		elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
439
			$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
-
 
440
		}
-
 
441
		elseif (!$GLOBALS['AUTH']->getAuth()) {
-
 
442
			$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
-
 
443
		}
-
 
444
		$res .='</p>'."\n";
-
 
445
		$res .= '</div>'."\n";
-
 
446
	}
-
 
447
	
-
 
448
	//on ajoute les commentaires, s'il le faut
-
 
449
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
-
 
450
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
451
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
-
 
452
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
-
 
453
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
-
 
454
		if (DB::isError ($resultat)) {
-
 
455
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
-
 
456
		}
-
 
457
		if ($resultat->numRows()>0) {
-
 
458
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
-
 
459
			if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
-
 
460
			else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
-
 
461
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
462
				$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
463
				//affichage du commentaire
-
 
464
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
-
 
465
				$res .= '<div class="BAZ_commentaire_admin">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bc_date']));
-
 
466
				//pour les identifies seulement, administrateurs de la rubrique ou superadmins
-
 
467
				if ($est_admin==1) {
-
 
468
					$url_comment= $GLOBALS['_BAZAR_']['url'];
-
 
469
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
-
 
470
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
-
 
471
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
-
 
472
					$res .= '&nbsp;&nbsp;<a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a>'."\n";
421
					if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
473
				}
422
				}
-
 
423
				$res .= '</ul><br />'."\n";
-
 
424
			}
-
 
425
			else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
-
 
426
			$res .='<p class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
427
			$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
-
 
428
			$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
-
 
429
			$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);			
-
 
430
			if ($possede_ressource) {
-
 
431
				$lien_appropriation->addQueryString('appropriation', 0);
-
 
432
				$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
-
 
433
				$lien_appropriation->removeQueryString('appropriation');
-
 
434
			}
-
 
435
			elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
436
				$lien_appropriation->addQueryString('appropriation', 1);
-
 
437
				$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
-
 
438
				$lien_appropriation->removeQueryString('appropriation');
-
 
439
			}
474
				$res .= '</div>'."\n";
440
			elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
441
				$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
-
 
442
			}
-
 
443
			elseif (!$GLOBALS['AUTH']->getAuth()) {
475
				$res .= '</div>'."\n";			
444
				$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
-
 
445
			}
-
 
446
			$res .='</p>'."\n";
476
			}
447
			$res .= '</div>'."\n";
477
		}
-
 
Line -... Line 448...
-
 
448
		}
-
 
449
		
-
 
450
		// Ajout des commentaires, s'il le faut
-
 
451
		if ($GLOBALS['_BAZAR_']['commentaire'] == 1) {
-
 
452
			$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
453
			$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
-
 
454
			$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
-
 
455
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
-
 
456
			if (DB::isError ($resultat)) {
-
 
457
				return $resultat->getMessage().'<br />'.$resultat->getDebugInfo();
-
 
458
			}
-
 
459
			if ($resultat->numRows()>0) {
-
 
460
				$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
-
 
461
				if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
-
 
462
				else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
-
 
463
				while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
464
					$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
-
 
465
					//affichage du commentaire
-
 
466
					$res .= $ligne['bc_commentaire'].'<br />'."\n";
-
 
467
					$res .= '<div class="BAZ_commentaire_admin">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bc_date']));
-
 
468
					//pour les identifies seulement, administrateurs de la rubrique ou superadmins
-
 
469
					if ($est_admin==1) {
-
 
470
						$url_comment= $GLOBALS['_BAZAR_']['url'];
-
 
471
						$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
-
 
472
						$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
-
 
473
						$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
-
 
474
						$res .= '&nbsp;&nbsp;<a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a>'."\n";
-
 
475
					}
-
 
476
					$res .= '</div>'."\n";
-
 
477
					$res .= '</div>'."\n";			
-
 
478
				}
-
 
479
			}
478
		else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
480
			else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
479
		
481
			
480
		//formulaire des commentaires
482
			//formulaire des commentaires
481
		$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
483
			$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
482
		$squelette =& $form_commentaire->defaultRenderer();
484
			$squelette =& $form_commentaire->defaultRenderer();
483
		$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
485
			$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
484
		$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
486
			$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
485
										'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
487
											'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
486
									    '</label><br />'."\n".'{element}<br />'."\n");
488
										    '</label><br />'."\n".'{element}<br />'."\n");
487
		$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
489
			$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
488
		$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
490
			$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
489
		$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
491
			$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
490
		$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
492
			$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
491
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
493
			require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
492
		$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
494
			$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
493
		$form_commentaire->addElement($formtexte) ;
495
			$form_commentaire->addElement($formtexte) ;
494
		$option=array('style'=>'border:1px solid #000;');
496
			$option=array('style'=>'border:1px solid #000;');
495
		$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
497
			$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
496
		$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
498
			$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
497
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
499
			$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
498
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
500
			$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
-
 
501
			$res .= $form_commentaire->toHTML();
499
		$res .= $form_commentaire->toHTML();
502
			$res .= '</div>'."\n";
Line 500... Line 503...
500
		$res .= '</div>'."\n";
503
		}
501
	}
504
	}
502
	
505
	
Line 1239... Line 1242...
1239
}
1242
}
Line 1240... Line 1243...
1240
 
1243
 
1241
/* +--Fin du code ----------------------------------------------------------------------------------------+
1244
/* +--Fin du code ----------------------------------------------------------------------------------------+
1242
*
1245
*
-
 
1246
* $Log: not supported by cvs2svn $
-
 
1247
* Revision 1.99.2.2  2007-11-30 15:02:50  alexandre_tb
-
 
1248
* simplification du code et correction du bug (les fiches de la carto n affichent pas la bonne nature
1243
* $Log: not supported by cvs2svn $
1249
*
1244
* Revision 1.99.2.1  2007-11-30 14:14:36  jp_milcent
1250
* Revision 1.99.2.1  2007-11-30 14:14:36  jp_milcent
1245
* Ajout d'un décodage des apostrophes de type RIGHT SINGLE QUOTATION MARK.
1251
* Ajout d'un décodage des apostrophes de type RIGHT SINGLE QUOTATION MARK.
1246
*
1252
*
1247
* Revision 1.99  2007-11-05 10:17:19  alexandre_tb
1253
* Revision 1.99  2007-11-05 10:17:19  alexandre_tb