Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 620 | Rev 660 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 620 Rev 655
Line 114... Line 114...
114
			}
114
			}
Line 115... Line 115...
115
			
115
 
116
		}
116
		}
Line 117... Line -...
117
	}
-
 
118
	
-
 
119
	
-
 
120
	
-
 
121
	
117
	}
122
	
118
 
123
	public function verifierParamChamps($param, $val) {
119
	public function verifierParamChamps($param, $val) {
124
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
120
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
125
		$champs_demandes = explode(',', $val);
121
		$champs_demandes = explode(',', $val);
Line 577... Line 573...
577
		$table_retour_json['entete'] = $this->remplirJsonEntete();
573
		$table_retour_json['entete'] = $this->remplirJsonEntete();
578
		$table_retour_json['resultat'] = $this->remplirJsonResultat($resultat);		
574
		$table_retour_json['resultat'] = $this->remplirJsonResultat($resultat);
579
		return $table_retour_json;
575
		return $table_retour_json;
580
	}
576
	}
Line 581... Line -...
581
	
-
 
582
	
-
 
583
	
-
 
584
 
-
 
585
	
577
 
586
	public function remplirJsonResultat($resultat) {
578
	public function remplirJsonResultat($resultat) {
587
		$champs = null;
579
		$champs = null;
588
		if (array_key_exists('retour.champs', $this->parametres)) {
580
		if (array_key_exists('retour.champs', $this->parametres)) {
589
			$champs = explode(',', $this->parametres['retour.champs']);
581
			$champs = explode(',', $this->parametres['retour.champs']);
-
 
582
		}
590
		}
583
		$noms = array();
591
		$resultat_json = null;
584
		$nomsRetenus = array();
592
		foreach ($resultat as $tab) {
585
		foreach ($resultat as $tab) {
593
			$this->table_retour = array();
586
			$this->table_retour = array();
594
			$num = $tab['num_nom'];
587
			$num = $tab['num_nom'];
595
			$this->afficherNomHrefRetenu($tab, $num); // ajoute le nom_sci, href et si le nom est retenu dans $this->table_retour
588
			$this->afficherNomHrefRetenu($tab, $num); // ajoute le nom_sci, href et si le nom est retenu dans $this->table_retour
Line 599... Line 592...
599
				$reponse_id = $this->formaterId($tab);
592
				$reponse_id = $this->formaterId($tab);
600
				$this->table_retour = array();
593
				$this->table_retour = array();
601
				$this->ajouterChampsPersonnalises($champs, $reponse_id);
594
				$this->ajouterChampsPersonnalises($champs, $reponse_id);
602
				$retour = array_merge($retour, $this->table_retour);
595
				$retour = array_merge($retour, $this->table_retour);
603
			}
596
			}
-
 
597
			// Sépare les noms retenus des autres noms
-
 
598
			if (isset($retour['retenu']) && $retour['retenu'] == 'true') {
604
			$resultat_json[$num] = $retour;
599
				$nomsRetenus[$num] = $retour;
-
 
600
			} else {
-
 
601
				$noms[$num] = $retour;
-
 
602
			}
605
		}
603
		}
-
 
604
		// Trie par ordre alphabétique de nom_sci
-
 
605
		$nomsRetenus = Tableau::trierMD($nomsRetenus, array('nom_sci' => SORT_ASC));
-
 
606
		$noms = Tableau::trierMD($noms, array('nom_sci' => SORT_ASC));
-
 
607
 
-
 
608
		// Rassemble la liste des noms avec les noms retenus en premier
-
 
609
		$nomsRetour = array();
-
 
610
		Tableau::etendre($nomsRetour, $nomsRetenus);
-
 
611
		Tableau::etendre($nomsRetour, $noms);
-
 
612
 
606
		return  $resultat_json; 
613
		return  $nomsRetour;
607
	}
614
	}
Line 608... Line 615...
608
	
615
 
609
	public function remplirJsonEntete() {
616
	public function remplirJsonEntete() {
610
		$entete = array();
617
		$entete = array();