* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL * @version $Id$ */ class CelImage extends Cel { /** * Méthode appelée avec une requête de type GET. */ public function getElement($params) { $parametres = $this->traiterParametres(array('mode'), $params, false); extract($parametres); $contenu = ''; $retour = null; if (isset($mode)) { $methode = $this->traiterNomMethodeGet($mode); if (method_exists($this, $methode)) { $this->parametres = array_shift($params); $retour = $this->$methode(); } else { $service = get_class($this); $this->messages[] = "Ce type de mode '$mode' pour le service '$service' n'est pas disponible."; } } else { $this->messages[] = "Vous devez indiquer un type de mode d'intérogation."; } if (is_null($retour)) { $contenu = 'Un problème est survenu : '.print_r($this->messages, true); } else { $contenu = $retour; } // Envoie sur la sortie standard $mime = 'text/html'; $encodage = 'UTF-8'; $formatage_json = (isset($retour)) ? true : false; $this->envoyer($contenu, $mime, $encodage, $formatage_json); } /** * Carte par défaut */ private function getListeIds() { $ids = array(); if (isset($_GET['obsId'])) { $observations = explode(',', $_GET['obsId']); $obsIds = null; foreach ($observations as $obs) { $obsIds[] = $this->bdd->quote($obs); } if (! is_null($obsIds)) { $requete = 'SELECT ci.id, cim.ci_id_image '. 'FROM cel_inventory AS ci '. ' LEFT JOIN cel_obs_images AS coi '. ' ON (coi.coi_ce_observation = ci.ordre AND coi.coi_ce_utilisateur = ci.identifiant) '. ' LEFT JOIN cel_images AS cim '. ' ON (coi.coi_ce_image = cim.ci_id_image) '. 'WHERE ci.id IN ('.implode(',', $obsIds).') '; $infos = $this->executerRequete($requete); foreach ($infos as $info) { $ids[$info['id']][] = (int) $info['ci_id_image']; } } } return $ids; } }