Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2457 → Rev 2458

/trunk/jrest/services/SelfRefList.php
1,10 → 1,20
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
 
// in utf8
// out utf8
 
// Fournit un référentiel relatif à l'utilisateur sur l'un des champs demandes
// declare(encoding='UTF-8');
/**
* Fournit une liste d'auto-complétions (=référentiel) relative à l'utilisateur sur l'un des champs demandés.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Auto-complétions
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class SelfRefList extends Cel {
 
private $referentiels = array('station', 'lieudit', 'milieu');
31,17 → 41,28
}
 
$referentiel_demande = $uid[1];
$idUtilisateur = Cel::db()->proteger($uid[0]);
$idUtilisateurP = Cel::db()->proteger($uid[0]);
 
$requete = "SELECT DISTINCT $referentiel_demande " .
'FROM cel_obs '.
"WHERE ce_utilisateur = '$idUtilisateur' ";
$filtreSql = '';
if ($this->filtreRechercheEstDemande()) {
$requete .= " AND $referentiel_demande LIKE '".$_GET["recherche"]."%'";
$rechercheP = Cel::db()->proteger($_GET['recherche'].'%');
$filtreRecherche = "AND $referentiel_demande LIKE $rechercheP ";
}
 
$limiteSql = '';
if ($this->limiteEstDemandee()) {
$requete .= " ORDER BY $referentiel_demande LIMIT ".$_GET['start'].','.$_GET['limit'];
$start = intval($_GET['start']);
$limit = intval($_GET['limit']);
$limite = "LIMIT $start,$limit ";
}
 
$requete = "SELECT DISTINCT $referentiel_demande " .
'FROM cel_obs '.
"WHERE ce_utilisateur = $idUtilisateurP ".
$filtreSql.
"ORDER BY $referentiel_demande ".
$limiteSql.
' -- '.__FILE__.':'.__LINE__;
$resultat = Cel::db()->requeter($requete);
 
$referentiel = array();
50,7 → 71,6
if ($this->estUneValeurValide($valeur[$referentiel_demande])) {
$referentiel[] = $valeur[$referentiel_demande];
}
 
}
}
$this->envoyerJson($referentiel);