Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 314 → Rev 315

/trunk/services/modules/0.1/eflore/Cartes.php
55,6 → 55,8
private $tab_code_insee = array();
public $src_map;
private $cartesFormateur = null;
const MIME_MAP = 'text/html';
const MIME_JPG = 'image/jpeg';
public function consulter($ressources, $param) {
// Initialisation des variables
77,25 → 79,20
}
if (isset($usemap)) {
$this->cartesFormateur->img();
if ($this->info['miniature'] !== 'min') {
$retour = $this->cartesFormateur->formaterCartes($usemap);
} else { // miniature
$retour = $this->cartesFormateur->formaterCarteMiniature($retour, $usemap);
}
$retour = $this->cartesFormateur->formaterCartes($usemap);
}
} else {
$retour = $this->formaterCarteVide();
}
if ($retour == '') {
$retour = $this->formaterCarteVide();
}
print_r($retour);
$resultat = new ResultatService();
$resultat->corps = ($this->info['retour'] == self::MIME_MAP) ? $retour : file_get_contents($retour);
$resultat->mime = ($this->info['retour'] == self::MIME_MAP) ? self::MIME_MAP : self::MIME_JPG;
return $resultat;
}
public function creerFormateur(){
$projet = ucwords($this->param['projet']);
$projet = ucwords($this->info['projet']);
$Classe = $projet.'Formateur';
$chemin = dirname(__FILE__).DS.'cartes'.DS;
$cheminClasse = $chemin.$Classe.'.php';
104,7 → 101,7
include_once $cheminInterface;
if (file_exists($cheminClasse)) {
include_once $cheminClasse;
$this->cartesFormateur = new $Classe($this->param, $this->info);
$this->cartesFormateur = new $Classe($this->info);
} else {
$message = "La classe '$Classe' est introuvable.";Debug::printr($message);
throw new Exception($message);
114,20 → 111,15
private function traiterParametres() {
$this->info['miniature'] = (isset($this->param['retour.format'])) ? $this->param['retour.format'] : false;
if ($this->info['miniature'] == 'min') {
$this->info['src_map'] = 'france_utm_miniature.jpg';
} else {
$this->info['src_map'] = 'france_utm_600x564.jpg';
}
$this->info['src_map'] = ($this->info['miniature'] == 'min') ? 'france_utm_miniature.jpg' : 'france_utm_600x564.jpg';
$this->info['retour'] = (isset($this->param['retour'])) ? $this->param['retour'] : self::MIME_JPG ;
// Ajout du code du r�f�rentiel
$this->info['referentiel'] = 'bdtfx';
$projets = array('cenlr', 'cel', 'cbnmed', 'sophy');
if (isset($this->param['projet'])) {
if (!in_array($this->param['projet'], $projets)) {
$this->param['projet'] = 'general';
}
if (isset($this->param['projet']) && in_array($this->param['projet'], $projets)) {
$this->info['projet'] = $this->param['projet'];
} else {
$this->param['projet'] = 'general';
$this->info['projet'] = 'general';
}
// R�cup�ration d'infos g�n�rales
// donnees exemple nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre';
198,7 → 190,7
if ($utm['name'] != null) {
$name = utf8_decode($utm['name']);
}
$comment = $this->cartesFormateur->formerCommentaire($utm, $inventory);
$comment = ($this->info['retour'] == self::MIME_MAP) ? $this->cartesFormateur->formerCommentaire($utm, $inventory) : '';
// On stocke les commentaires pour affichage dans les tooltips
// Commentaire deja pr�sent ? : on ajoute � la suite
list($text, $merge) = $this->cartesFormateur->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y);
215,7 → 207,10
$dest_map['vide'] = 'vide_'.$this->info['src_map'];
$img['vide'] = imagecreatefromjpeg($this->cheminCartesBase.$this->info['src_map']);
imagejpeg($img['vide'], Config::get('cache.stockageChemin').$dest_map['vide'], 90);
$retour = "<img src=\"".Config::get('cel_dst').$dest_map['vide']."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
$retour = Config::get('cel_dst').$dest_map['vide'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
}
return $retour;
}