Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

Ignore whitespace Rev 18 → Rev 19

/trunk/modeles/RechercheDao.php
13,33 → 13,18
*
*/
class RechercheDao extends ColModele {
 
const SERVICE = 'CoelRecherche';
/**
* Recherche une collection en fonction de paramêtres
* @return array un tableau contenant des objets d'informations sur les collections
*/
public function chercherStructureNbre($parametres) {
$requete = 'SELECT COUNT(cc_id_collection) AS nbre '.
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
'WHERE ('.
" cc_nom LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
" OR cc_description LIKE '%{$parametres['mots']}%' ".
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
') '.
'ORDER BY cs_ville ASC, cc_nom ASC ';
$donnees = $this->requeteUn($requete);
//Debug::printr($requete);
return $donnees['nbre'];
$mots = urlencode($parametres['mots']);
$url = $this->url_jrest.self::SERVICE."/Nombre/$mots";
$json = file_get_contents($url);
$donnees = json_decode($json);
return $donnees;
}
/**
47,29 → 32,12
* @return array un tableau contenant des objets d'informations sur les collections
*/
public function chercher($parametres) {
$requete = 'SELECT cs_id_structure, cs_ville, cs_nom, '.
' cc_id_collection, cc_nom '.
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
'WHERE ('.
" cc_nom LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
" OR cc_description LIKE '%{$parametres['mots']}%' ".
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
') '.
'ORDER BY cs_ville ASC, cc_nom ASC '.
($this->avoirLimitation() ? "LIMIT {$this->getLimiteDebut()}, {$this->getLimiteNbre()} " : '');
$donnees = $this->requeteTous($requete);
//Debug::printr($requete);
$mots = urlencode($parametres['mots']);
$url = $this->url_jrest.self::SERVICE."/ParDefaut/$mots";
$url .= ($this->avoirLimitation() ? "?start={$this->getLimiteDebut()}&limit={$this->getLimiteNbre()}" : '');
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
}
}
}
?>
/trunk/modeles/PersonneDao.php
13,6 → 13,7
*
*/
class PersonneDao extends ColModele {
const SERVICE_PERSONNE = 'CoelPersonne';
 
/**
* Retourne l'ensemble des information d'une personne.
21,7 → 22,8
* @return array un tableau contenant les informations sur la personne.
*/
public function getPersonne($id) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelPersonne/$id");
$url = $this->url_jrest.self::SERVICE_PERSONNE."/$id";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
}
/trunk/modeles/CollectionDao.php
13,7 → 13,10
*
*/
class CollectionDao extends ColModele {
 
const SERVICE_COLLECTION = 'CoelCollection';
const SERVICE_COLLECTION_A_PERSONNE = 'CoelCollectionAPersonne';
const SERVICE_COLLECTION_A_PUBLICATION = 'CoelCollectionAPublication';
const SERVICE_COLLECTION_A_COMMENTAIRE = 'CoelCollectionACommentaire';
/**
* Retourne l'ensemble des information sur une collection.
*
33,7 → 36,8
* @return array un tableau contenant les collections correspondant à l'id structure.
*/
public function getParIdStructure($id_structure) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelCollection/ParIdStructure/$id_structure");
$url = $this->url_jrest.self::SERVICE_COLLECTION."/ParIdStructure/$id_structure";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
$this->nettoyerTableauDeTableauxAssoc($donnees);
return $donnees;
46,7 → 50,8
* @return array un tableau contenant les informations sur les personnes liées à la collection.
*/
public function getCollectionAPersonne($id_collection) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelCollectionAPersonne/$id_collection");
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
$this->nettoyerTableauDeTableauxAssoc($donnees);
return $donnees;
59,10 → 64,26
* @return array un tableau contenant les informations sur les publications liées à la collection.
*/
public function getCollectionAPublication($id_collection) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelCollectionAPublication/$id_collection");
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
$this->nettoyerTableauDeTableauxAssoc($donnees);
return $donnees;
}
/**
* Retourne l'ensemble des commentaires publics liés à une collection.
*
* @param integer l'id de la collection.
* @return array un tableau contenant les informations sur les publications liées à la collection.
*/
public function getCollectionACommentaire($id_collection) {
$commentaire_public = '1';
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
$this->nettoyerTableauDeTableauxAssoc($donnees);
return $donnees;
}
}
?>
/trunk/modeles/MetadonneeDao.php
13,7 → 13,8
*
*/
class MetadonneeDao extends ColModele {
 
const SERVICE_ONTOLOGIE = 'CoelValeurListe';
/**
* Retourne l'ensemble des information d'une liste de valeurs.
*
21,7 → 22,8
* @return array un tableau contenant les valeurs de la liste.
*/
public function getOntologie($id) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelValeurListe/id/$id?limit=500");
$url = $this->url_jrest.self::SERVICE_ONTOLOGIE."/id/$id?limit=500";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
}
33,7 → 35,8
* @return array un tableau contenant les valeurs.
*/
public function getOntologieValeur($id_valeurs) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelValeurListe/idv/$id_valeurs");
$url = $this->url_jrest.self::SERVICE_ONTOLOGIE."/idv/$id_valeurs";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
}
/trunk/modeles/StructureDao.php
13,7 → 13,9
*
*/
class StructureDao extends ColModele {
 
const SERVICE_STRUCTURE = 'CoelStructure';
const SERVICE_STRUCTURE_A_PERSONNE = 'CoelStructureAPersonne';
/**
* Retourne l'ensemble des information sur une structure.
*
21,7 → 23,8
* @return array un tableau contenant les informations sur la structure.
*/
public function getStructure($id) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelStructure/*/$id/*");
$url = $this->url_jrest.self::SERVICE_STRUCTURE."/*/$id/*";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees[1];
}
33,7 → 36,8
* @return array un tableau contenant les informations sur le personnel de la structure.
*/
public function getPersonnel($id) {
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelStructureAPersonne/$id");
$url = $this->url_jrest.self::SERVICE_STRUCTURE_A_PERSONNE."/$id";
$json = file_get_contents($url);
$donnees = json_decode($json, true);
$this->nettoyerTableauDeTableauxAssoc($donnees);
return $donnees;