Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1277 Rev 1325
Line 263... Line 263...
263
	
263
	
264
	/**
264
	/**
265
	* Charger les votes pour chaque image
265
	* Charger les votes pour chaque image
266
	* */
266
	* */
-
 
267
	private function chargerPropositionPlusProbable($images) {
Line 267... Line 268...
267
	private function chargerPropositionPlusProbable($images) {
268
			$this->obsIds = array(368594);
268
			
269
			
269
			$requetePropositions = 'SELECT * FROM '.
270
			$requetePropositions = 'SELECT * FROM '.
270
								'del_commentaire '.
271
								'del_commentaire '.
Line 298... Line 299...
298
					$votes[$vote['ce_proposition']] = 0;
299
					$votes[$vote['ce_proposition']] = 0;
299
				}
300
				}
300
				$valeur = ($vote['valeur'] == 1) ? 1 : -1;
301
				$valeur = ($vote['valeur'] == 1) ? 1 : -1;
301
				$votes[$vote['ce_proposition']] += is_numeric($vote['ce_utilisateur']) ? 3*$valeur : $valeur;
302
				$votes[$vote['ce_proposition']] += is_numeric($vote['ce_utilisateur']) ? 3*$valeur : $valeur;
302
			}
303
			}
303
			
304
						
304
			foreach($resultatsPropositions as $proposition) {
305
			foreach($resultatsPropositions as $proposition) {
305
				$id_proposition = $proposition['id_commentaire'];
306
				$id_proposition = $proposition['id_commentaire'];
306
				$id_obs = $proposition['ce_observation'];
307
				$id_obs = $proposition['ce_observation'];
Line 307... Line 308...
307
				
308
				
308
				if(isset($votes[$id_proposition])) {
309
				if(isset($votes[$id_proposition])) {
309
					$score = $votes[$id_proposition];
310
					$score = $votes[$id_proposition];
310
				} else {
311
				} else {
311
					$score = -1;
312
					$score = -1;
312
				}
313
				}
313
				
314
								
314
				$proposition['valeur'] = $score;
-
 
315
				
315
				$proposition['valeur'] = $score;
316
				if(!isset($propositions[$id_obs])) {
316
				if(!isset($propositions[$id_obs])) {
317
					$propositions[$id_obs] = $proposition;
317
					$propositions[$id_obs] = $proposition;
318
				} else {
318
				} else {
319
					$score_ancienne_proposition = $propositions[$id_obs]['valeur'];
319
					$score_ancienne_proposition = $propositions[$id_obs]['valeur'];
Line 333... Line 333...
333
 
333
 
334
			foreach ($images as $id => $image) {
334
			foreach ($images as $id => $image) {
335
				if ($this->doitRemplacerObservationParProposition($propositions, $image)) {					
335
				if ($this->doitRemplacerObservationParProposition($propositions, $image)) {					
336
					$id_obs = $image['id_observation'];
336
					$id_obs = $image['id_observation'];
337
					$images[$id]['determination.famille'] = $propositions[$id_obs]['famille'];
337
					$images[$id]['determination.famille'] = $propositions[$id_obs]['famille'];
338
					$images[$id]['determination.ns'] = $propositions[$id_obs]['nom_ret'];
338
					$images[$id]['determination.ns'] = $propositions[$id_obs]['nom_sel'];
339
					$images[$id]['determination.nn'] = $propositions[$id_obs]['nom_ret_nn'];
339
					$images[$id]['determination.nn'] = $propositions[$id_obs]['nom_sel_nn'];
340
					$images[$id]['determination.nt'] = $propositions[$id_obs]['nt'];
340
					$images[$id]['determination.nt'] = $propositions[$id_obs]['nt'];
Line 341... Line 341...
341
				}
341
				}
342
				
342
				
Line 346... Line 346...
346
			}
346
			}
Line 347... Line 347...
347
		
347
		
348
		return $images;
348
		return $images;
Line 349... Line 349...
349
	}
349
	}
350
	
350
	
351
	private function doitRemplacerObservationParProposition($propositions, $image) {		
351
	private function doitRemplacerObservationParProposition($propositions, $image) {			
352
		return ((isset($propositions[$image['id_observation']]) && 
352
		return ((isset($propositions[$image['id_observation']]) && 
353
			$propositions[$image['id_observation']] != null &&
353
			$propositions[$image['id_observation']] != null &&
354
			$propositions[$image['id_observation']]['nom_ret_nn'] != 0) && 
354
			$propositions[$image['id_observation']]['nom_sel_nn'] != 0) && 
355
			($propositions[$image['id_observation']]['valeur'] > 0 ||
355
			($propositions[$image['id_observation']]['valeur'] > 0 ||
356
			$image['determination.nn'] == 0)
356
			$image['determination.nn'] == 0)