Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3145 Rev 3470
Line 16... Line 16...
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
17
 */
17
 */
18
class RechercheObservationExport extends Cel {
18
class RechercheObservationExport extends Cel {
Line 19... Line 19...
19
	
19
	
-
 
20
	public $requete_selection_observations;
20
	public $requete_selection_observations;
21
	private $table = "cel_export";
21
	public static $tris_possibles = array(
22
	public static $tris_possibles = array(
22
			'nom_referentiel',
23
			'nom_referentiel',
23
			'nom_sel',
24
			'nom_sel',
24
			'certitude',
25
			'certitude',
Line 32... Line 33...
32
	);
33
	);
Line 33... Line 34...
33
	
34
	
-
 
35
	
34
	
36
	
-
 
37
	public function rechercherObservations($id_utilisateur = null, $criteres = array(), $debut = 0, $limite = 50, $autoriser_sql_brut = FALSE) {
35
	
38
	    if ((isset($criteres['standard']) && $criteres['standard'] == 0) || (!isset($criteres['standard']))) {
-
 
39
	        $this->table = "cel_export_total";
-
 
40
	    }
36
	public function rechercherObservations($id_utilisateur = null, $criteres = array(), $debut = 0, $limite = 50, $autoriser_sql_brut = FALSE) {
41
	    unset($criteres['standard']);
37
		$requete_selection_observations = 'SELECT * FROM cel_export ';
42
	    $requete_selection_observations = 'SELECT * FROM '.$this->table.' ';
38
		unset($criteres['standard']);
43
		
39
		if ($id_utilisateur != null) {
44
		if ($id_utilisateur != null) {
40
			$requete_selection_observations .= 'WHERE ce_utilisateur = '.Cel::db()->proteger($id_utilisateur).' AND ';
45
			$requete_selection_observations .= 'WHERE ce_utilisateur = '.Cel::db()->proteger($id_utilisateur).' AND ';
Line 67... Line 72...
67
		}
72
		}
68
		return Cel::db()->requeter($this->requete_selection_observations);
73
		return Cel::db()->requeter($this->requete_selection_observations);
69
	}
74
	}
Line 70... Line 75...
70
	
75
	
-
 
76
	public function compterObservations($id_utilisateur = null, $criteres = array()) {
-
 
77
	    if ((isset($criteres['standard']) && $criteres['standard'] == 0) || (!isset($criteres['standard']))) {
-
 
78
	        $this->table = "cel_export_total";
71
	public function compterObservations($id_utilisateur = null, $criteres = array()) {
79
	    }
72
		unset($criteres['standard']);
80
	    unset($criteres['standard']);
73
		$requete = 'SELECT COUNT(*) AS nb_obs FROM cel_export ';
81
		$requete = 'SELECT COUNT(*) AS nb_obs FROM '.$this->table.' ';
74
		if ($id_utilisateur != null) {
82
		if ($id_utilisateur != null) {
75
			$requete .= 'WHERE ce_utilisateur = '.Cel::db()->proteger($id_utilisateur).' AND ';
83
			$requete .= 'WHERE ce_utilisateur = '.Cel::db()->proteger($id_utilisateur).' AND ';
76
		} else if(count($criteres) > 0) {
84
		} else if(count($criteres) > 0) {
77
			$requete .= 'WHERE ';
85
			$requete .= 'WHERE ';
Line 102... Line 110...
102
					$observation[$champ] = '';
110
					$observation[$champ] = '';
103
				}
111
				}
104
			}
112
			}
105
		}
113
		}
Line 106... Line 114...
106
		
114
		
107
		$gestion_champs_etendus = new GestionChampsEtendus($this->config, 'obs');
115
		$gestion_champs_etendus = new GestionChampsEtendus2($this->config);
Line 108... Line 116...
108
		$champs_supp = $gestion_champs_etendus->consulterParLots($ids);
116
		$champs_supp = $gestion_champs_etendus->consulterParLots($ids);
109
		
117
		
110
		foreach ($tableau_observations as &$obs) {
118
		foreach ($tableau_observations as &$obs) {