Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 314 → Rev 315

/trunk/services/modules/0.1/eflore/cartes/CbnmedFormateur.php
2,8 → 2,7
class CbnmedFormateur implements Formateur {
public $dest_map = array();
public $img = array();
public function __construct($parametres, $info) {
$this->param = $parametres;
public function __construct($info) {
$this->info = $info;
}
public function img() {
82,11 → 81,12
}
public function formaterCartes($usemap) {
$retour= "<img src=\"".(Config::get('Cartes.cel_dst').$this->dest_map['cbnmed'])."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcbnmed\"></img><br />\n";
$retour.= "<map name=\"themapcbnmed\" id=\"themapcbnmed\">";
$retour.= $usemap['cbnmed'];
$retour.= "</map>";
 
$retour = Config::get('Cartes.cel_dst').$this->dest_map['cbnmed'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; ".
"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['cbnmed'])."</map>";
}
return $retour;
}
/trunk/services/modules/0.1/eflore/cartes/GeneralFormateur.php
1,9 → 1,8
<?php
class GeneralFormateur {
class GeneralFormateur implements Formateur {
public $dest_map = array();
public $img = array();
public function __construct($parametres, $info) {
$this->param = $parametres;
public function __construct($info) {
$this->info = $info;
}
public function img() {
129,21 → 128,11
}
public function formaterCartes($usemap) {
$retour = "<img src=\"".(Config::get('Cartes.cel_dst').$this->dest_map['general'])."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n";
$retour .= "<map name=\"themap\" id=\"themap\">";
$retour .= $usemap['general'];
$retour .= "</map>";
return $retour;
}
public function formaterCarteMiniature($retour, $usemap) {
$retour['image'] = Config::get('Cartes.cel_dst').$this->dest_map['general'];
$retour['map'] = $usemap['general'];
if (isset($this->param['retour']) && $this->param['retour'] == 'htm') {
$retour['image'] = "<img src=\"".$retour['image']."\" style=\"border:none; cursor:crosshair\""
."alt=\"\" usemap=\"#themap\"></img><br />\n";
$retour['map'] = "<map name=\"themap\" id=\"themap\">".$retour['map']."</map>";
$retour = Config::get('Cartes.cel_dst').$this->dest_map['general'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; ".
"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['general'])."</map>";
}
return $retour;
}
/trunk/services/modules/0.1/eflore/cartes/Formateur.php
1,6 → 1,8
<?php
interface Formateur {
public function __construct($parametres, $info);
const MIME_MAP = 'text/html';
const MIME_JPG = 'image/jpeg';
public function __construct($info);
public function initialiserImage();
public function chargerDonnees();
public function dessinerPoint($text, $merge, $couleurs);
/trunk/services/modules/0.1/eflore/cartes/SophyFormateur.php
2,8 → 2,7
class SophyFormateur implements Formateur {
public $dest_map = array();
public $img = array();
public function __construct($parametres, $info) {
$this->param = $parametres;
public function __construct($info) {
$this->info = $info;
}
public function img() {
74,10 → 73,12
}
public function formaterCartes($usemap) {
$retour= "<img src=\"".(Config::get('Cartes.cel_dst').$this->dest_map['sophy'])."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapsophy\"></img><br />\n";
$retour.= "<map name=\"themapsophy\" id=\"themapsophy\">";
$retour.= $usemap['sophy'];
$retour.= "</map>";
$retour = Config::get('Cartes.cel_dst').$this->dest_map['sophy'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; ".
"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['sophy'])."</map>";
}
return $retour;
}
116,11 → 117,9
 
public function formerCommentaire($utm, $inventory) {
$comment = '';
if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
$comment .= $this->formerDate($inventory);
}
$comment .= " par ".utf8_decode($inventory['identifiant']);
return $comment;
}
151,12 → 150,10
$text[$x.'|'.$y][$origine] = $name.$comment;
}
if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])||
(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
$merge[$x.'|'.$y]=true;
}
if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])||
(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
$merge[$x.'|'.$y] = true;
}
return array($text, $merge);
}
/trunk/services/modules/0.1/eflore/cartes/CelFormateur.php
2,8 → 2,7
class CelFormateur implements Formateur {
public $dest_map = array();
public $img = array();
public function __construct($parametres, $info) {
$this->param = $parametres;
public function __construct($info) {
$this->info = $info;
}
public function img() {
78,12 → 77,13
return $usemap;
}
public function formaterCartes($usemap) {
$retour= "<img src=\"".(Config::get('Cartes.cel_dst').$this->dest_map['cel'])."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcel\"></img><br />\n";
$retour.= "<map name=\"themapcel\" id=\"themapcel\">";
$retour.= $usemap['cel'];
$retour.= "</map>";
public function formaterCartes($usemap) {
$retour = Config::get('Cartes.cel_dst').$this->dest_map['cel'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; ".
"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['cel'])."</map>";
}
return $retour;
}
/trunk/services/modules/0.1/eflore/cartes/CenlrFormateur.php
2,8 → 2,7
class CenlrFormateur implements Formateur {
public $dest_map = array();
public $img = array();
public function __construct($parametres, $info) {
$this->param = $parametres;
public function __construct($info) {
$this->info = $info;
}
public function img() {
80,11 → 79,12
}
public function formaterCartes($usemap) {
$retour = "<img src=\"".(Config::get('Cartes.cel_dst').$this->dest_map['cenlr'])."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcenlr\"></img><br />\n";
$retour .= "<map name=\"themapcenlr\" id=\"themapcenlr\">";
$retour .= $usemap['cenlr'];
$retour .= "</map>";
 
$retour = Config::get('Cartes.cel_dst').$this->dest_map['cenlr'];
if ($this->info['retour'] == self::MIME_MAP) {
$retour = "<img src=\"".$retour."\" style=\"border:none; ".
"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['cenlr'])."</map>";
}
return $retour;
}
/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;
}