Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

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