Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1408 Rev 1429
Line 79... Line 79...
79
		
79
		
80
		unset($criteres['limite']);
80
		unset($criteres['limite']);
Line 81... Line 81...
81
		unset($criteres['debut']);
81
		unset($criteres['debut']);
82
	
-
 
-
 
82
	
-
 
83
		$observations = $chercheur_observations->rechercherObservations(null, $criteres, $numero_page, $limite);
83
		$observations = $chercheur_observations->rechercherObservations(null, $criteres, $numero_page, $limite);
84
		$observations = array_slice($observations, 0, 10000);
84
		
85
		//echo count($observations);exit;
85
		switch($this->format) {
86
		switch($this->format) {
86
			case 'csv':
87
			case 'csv':
87
				$csv = $this->convertirEnCsv($observations);
88
				$csv = $this->convertirEnCsv($observations);
Line 122... Line 123...
122
	{
123
	{
123
		$chemin_temp = "php://temp";
124
		$chemin_temp = "php://temp";
124
		$outstream = fopen($chemin_temp, 'r+');
125
		$outstream = fopen($chemin_temp, 'r+');
125
		$intitule_champs = array();
126
		$intitule_champs = array();
126
		foreach($data as $ligne) {
127
		foreach($data as $ligne) {
-
 
128
			$ligne = $this->filtrerDonneesSensibles($ligne);
127
			$ligne = array_diff_key($ligne, $this->champs_a_exclure);
129
			$ligne = array_diff_key($ligne, $this->champs_a_exclure);
128
			if(empty($intitule_champs)) {
130
			if(empty($intitule_champs)) {
129
				$intitule_champs = $this->creerEntetesChamps($ligne);
131
				$intitule_champs = $this->creerEntetesChamps($ligne);
130
				fputcsv($outstream, $intitule_champs, ',', '"');			
132
				fputcsv($outstream, $intitule_champs, ',', '"');			
131
			}
133
			}
Line 147... Line 149...
147
		$workbook->send($this->nom_fichier_export.'.xls');
149
		$workbook->send($this->nom_fichier_export.'.xls');
Line 148... Line 150...
148
		
150
		
Line 149... Line 151...
149
		$nb_lignes = 1;
151
		$nb_lignes = 1;
-
 
152
		
150
		
153
		foreach($data as $ligne) {
151
		foreach($data as $ligne) {
154
			$ligne = $this->filtrerDonneesSensibles($ligne);
152
			$ligne = array_diff_key($ligne, $this->champs_a_exclure);
155
			$ligne = array_diff_key($ligne, $this->champs_a_exclure);
153
			if(empty($intitule_champs)) {
156
			if(empty($intitule_champs)) {
154
				$intitule_champs = $this->creerEntetesChamps($ligne);
157
				$intitule_champs = $this->creerEntetesChamps($ligne);
Line 171... Line 174...
171
	private function creerEntetesChamps($noms_colonnes) {
174
	private function creerEntetesChamps($noms_colonnes) {
172
		$champs_presents = array_intersect_key($this->correspondance_champs, $noms_colonnes);
175
		$champs_presents = array_intersect_key($this->correspondance_champs, $noms_colonnes);
173
		return array_values($champs_presents);
176
		return array_values($champs_presents);
174
	}
177
	}
Line -... Line 178...
-
 
178
	
-
 
179
	private function filtrerDonneesSensibles($ligne) {
-
 
180
		if(stripos($ligne['mots_cles_texte'], 'sensible') !== false) {
-
 
181
			$ligne['latitude'] = '';
-
 
182
			$ligne['longitude'] = '';
-
 
183
		}
-
 
184
		return $ligne;
-
 
185
	}
175
	
186
	
176
	private function nettoyerChaine($chaine) {
187
	private function nettoyerChaine($chaine) {
177
		$chaine = str_replace("\n",' ',$chaine);
188
		$chaine = str_replace("\n",' ',$chaine);
178
		$chaine = str_replace("\t",'',$chaine);
189
		$chaine = str_replace("\t",'',$chaine);
179
		return $chaine;
190
		return $chaine;