Subversion Repositories eFlore/Applications.cel

Rev

Rev 1765 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
416 aurelien 1
<?php
2458 jpm 2
// declare(encoding='UTF-8');
863 aurelien 3
/**
2458 jpm 4
 * Service renvoyant un fragment de HTML constitué à partir d'une liste très succinte des contributions
5
 * de l'utilisateur.
6
 *
7
 * @internal   Mininum PHP version : 5.2
8
 * @category   CEL
9
 * @package    Services
10
 * @subpackage Observations
11
 * @version    0.1
12
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
13
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
14
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
15
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
16
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
17
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
863 aurelien 18
 */
19
class InventoryContributionList extends Cel {
416 aurelien 20
 
2458 jpm 21
	public function getRessource() {
416 aurelien 22
		echo '';
23
	}
24
 
2458 jpm 25
	/**
26
	 * Retourne la liste des contributions au format HTML.
27
	 *
28
	 * @param int $uid[0] identitifiant de l'utilisateur
29
	 */
30
	public function getElement($uid){
31
		if (!isset($uid[0])) {
416 aurelien 32
			echo '';
33
		}
34
 
2458 jpm 35
		$idUtilisateurP = Cel::db()->proteger($uid[0]);
36
		$requete = 'SELECT * FROM cel_obs '.
37
			"WHERE ce_utilisateur = $idUtilisateurP ".
38
			'ORDER BY date_modification DESC '.
39
			'LIMIT 0,5 '.
40
			' -- '.__FILE__.':'.__LINE__;
41
		$resultat_contributions = Cel::db()->requeter($requete);
416 aurelien 42
 
2458 jpm 43
		$resume = '';
44
		if (is_array($resultat_contributions)) {
863 aurelien 45
			foreach ($resultat_contributions as $ligne) {
46
				$ligne['nom_sel'] = htmlspecialchars($ligne['nom_sel']);
47
				$ligne['ce_utilisateur'] = htmlspecialchars($ligne['ce_utilisateur']);
900 aurelien 48
				$ligne['zone_geo'] = htmlspecialchars($ligne['zone_geo']);
49
				$ligne['id_zone_geo'] = htmlspecialchars($this->convertirCodeZoneGeoVersDepartement($ligne['ce_zone_geo']));
863 aurelien 50
				$ligne['station'] = htmlspecialchars($ligne['station']);
51
				$ligne['milieu'] = htmlspecialchars($ligne['milieu']);
52
				$ligne['commentaire'] = htmlspecialchars($ligne['commentaire']);
53
				$ligne['transmission'] = htmlspecialchars($ligne['transmission']);
2458 jpm 54
 
55
				$resume.= '<p>'.$ligne['nom_sel'] ." (".$ligne['nom_sel_nn'].") ".
56
						'Location : '. $ligne['zone_geo']." (".$ligne['id_zone_geo']."),". $ligne['station'] . "," .
57
						$ligne['milieu'] . "," . $ligne['commentaire'] . "," . $ligne['transmission'] .
58
					'</p>';
863 aurelien 59
			}
2458 jpm 60
	   }
416 aurelien 61
 
2458 jpm 62
		header('Content-Type: text/html; charset=ISO-8859-1');
63
		print $resume;
64
		exit();
65
	}
66
}