| Line 27... |
Line 27... |
| 27 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
27 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 28 |
*@copyright Tela-Botanica 2000-2003
|
28 |
*@copyright Tela-Botanica 2000-2003
|
| 29 |
*@version 01 juillet 2002
|
29 |
*@version 01 juillet 2002
|
| 30 |
// +-----------------------------------------------------------------------------------------------+
|
30 |
// +-----------------------------------------------------------------------------------------------+
|
| 31 |
//
|
31 |
//
|
| 32 |
// $Id: lib.carto.php,v 1.5 2006-12-01 13:23:16 florian Exp $
|
32 |
// $Id: lib.carto.php,v 1.6 2006-12-12 10:37:45 alexandre_tb Exp $
|
| 33 |
// FICHIER : $RCSfile: lib.carto.php,v $
|
33 |
// FICHIER : $RCSfile: lib.carto.php,v $
|
| 34 |
// AUTEUR : $Author: florian $
|
34 |
// AUTEUR : $Author: alexandre_tb $
|
| 35 |
// VERSION : $Revision: 1.5 $
|
35 |
// VERSION : $Revision: 1.6 $
|
| 36 |
// DATE : $Date: 2006-12-01 13:23:16 $
|
36 |
// DATE : $Date: 2006-12-12 10:37:45 $
|
| 37 |
//
|
37 |
//
|
| 38 |
// +-----------------------------------------------------------------------------------------------+
|
38 |
// +-----------------------------------------------------------------------------------------------+
|
| 39 |
// A FAIRE :
|
39 |
// A FAIRE :
|
| 40 |
// 1.-Rendre cette classe indépendante de l'arborescence du site.
|
40 |
// 1.-Rendre cette classe indépendante de l'arborescence du site.
|
| 41 |
// On trouve encore des urls ou des chemins d'accé au fichier codé en dur dans l'appli
|
41 |
// On trouve encore des urls ou des chemins d'accé au fichier codé en dur dans l'appli
|
| Line 96... |
Line 96... |
| 96 |
$res.= '<a ';
|
96 |
$res.= '<a ';
|
| Line 97... |
Line 97... |
| 97 |
|
97 |
|
| 98 |
if (!empty($this->class_css)) {
|
98 |
if (!empty($this->class_css)) {
|
| 99 |
$res.='class="'.$this->class_css.'" ';
|
99 |
$res.='class="'.$this->class_css.'" ';
|
| 100 |
}
|
- |
|
| - |
|
100 |
}
|
| 101 |
|
101 |
$GLOBALS['ins_url']->addQueryString('historique_cartes', $chemin);
|
| 102 |
$res.='href="'.$this->url.'&historique_cartes='.$chemin.'"> '.$this->caractere_separation.' '.$tabnom[$key].'</a>';
|
102 |
$res.='href="'.$GLOBALS['ins_url']->getURL().'"> '.$this->caractere_separation.' '.$tabnom[$key].'</a>';
|
| 103 |
}
|
103 |
}
|
| 104 |
$res.= '</div>'."\n";
|
104 |
$res.= '</div>'."\n";
|
| Line 105... |
Line 105... |
| 105 |
return $res;
|
105 |
return $res;
|
| Line 200... |
Line 200... |
| 200 |
$action['id_zone_geo'] = $ligne->$chp_id_zone_geo;
|
200 |
$action['id_zone_geo'] = $ligne->$chp_id_zone_geo;
|
| 201 |
$action['type_action'] = $ligne->$chp_action;
|
201 |
$action['type_action'] = $ligne->$chp_action;
|
| 202 |
$action['id_carte_destination'] = $ligne->$chp_id_carte_destination;
|
202 |
$action['id_carte_destination'] = $ligne->$chp_id_carte_destination;
|
| Line 203... |
Line 203... |
| 203 |
|
203 |
|
| - |
|
204 |
return $action;
|
| - |
|
205 |
} else {
|
| 204 |
return $action;
|
206 |
return array ('type_action' => 'Recharger');
|
| 205 |
}
|
207 |
}
|
| Line 206... |
Line 208... |
| 206 |
}//Fin de la méthode _consulterActionImage().
|
208 |
}//Fin de la méthode _consulterActionImage().
|
| 207 |
|
209 |
|
| Line 315... |
Line 317... |
| 315 |
$this->masque = $chemin.$masque;
|
317 |
$this->masque = $chemin.$masque;
|
| 316 |
$this->fond = $chemin.$fond;
|
318 |
$this->fond = $chemin.$fond;
|
| 317 |
$this->chemin = $chemin;
|
319 |
$this->chemin = $chemin;
|
| 318 |
$this->_info_table_zg = $info_table;
|
320 |
$this->_info_table_zg = $info_table;
|
| Line -... |
Line 321... |
| - |
|
321 |
|
| 319 |
|
322 |
|
| - |
|
323 |
$this->_action = new Carto_Action($info_table['nom_table_zone'],$info_table['nom_chp_id_zone'],
|
| 320 |
$this->_action = new Carto_Action($info_table['nom_table_zone'],$info_table['nom_chp_id_zone'], $info_table['nom_chp_rouge'], $info_table['nom_chp_vert'], $info_table['nom_chp_bleu'],
|
324 |
$info_table['nom_chp_rouge'], $info_table['nom_chp_vert'], $info_table['nom_chp_bleu'],
|
| - |
|
325 |
'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone',
|
| 321 |
'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone', 'CA_Action', 'CA_ID_Carte_destination');
|
326 |
'CA_Action', 'CA_ID_Carte_destination');
|
| 322 |
$this->fils = array();
|
327 |
$this->fils = array();
|
| 323 |
$this->filiation = $id;
|
328 |
$this->filiation = $id;
|
| 324 |
$this->historique_cartes = '';
|
329 |
$this->historique_cartes = '';
|
| 325 |
$this->liste_zone_carte = '';
|
330 |
$this->liste_zone_carte = '';
|
| Line 398... |
Line 403... |
| 398 |
// -soit false.
|
403 |
// -soit false.
|
| 399 |
//**********************************************************************************************************
|
404 |
//**********************************************************************************************************
|
| Line 400... |
Line 405... |
| 400 |
|
405 |
|
| 401 |
function donnerFormulaireImage ()
|
406 |
function donnerFormulaireImage ()
|
| 402 |
{
|
- |
|
| 403 |
global $GS_GLOBAL;
|
407 |
{
|
| Line 404... |
Line 408... |
| 404 |
$res = '';
|
408 |
$res = '';
|
| 405 |
|
409 |
|
| 406 |
// Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
|
410 |
// Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
|
| Line 441... |
Line 445... |
| 441 |
}
|
445 |
}
|
| Line 442... |
Line 446... |
| 442 |
|
446 |
|
| Line 443... |
Line 447... |
| 443 |
// on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
|
447 |
// on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
|
| 444 |
|
448 |
|
| 445 |
$action = $this->_action->_consulterActionImage($this->image_x, $this->image_y, $this->masque, $this->id);
|
449 |
$action = $this->_action->_consulterActionImage($this->image_x, $this->image_y, $this->masque, $this->id);
|
| 446 |
|
450 |
|
| 447 |
// Nous distinguons 2 cas :
|
451 |
// Nous distinguons 2 cas :
|
| Line 448... |
Line 452... |
| 448 |
//le cas ou il faut afficher une nouvelle carte ... :
|
452 |
//le cas ou il faut afficher une nouvelle carte ... :
|
| Line 508... |
Line 512... |
| 508 |
// On teste maintenant si l'on vient d'un lien. Si c'est le cas on a recu un argument
|
512 |
// On teste maintenant si l'on vient d'un lien. Si c'est le cas on a recu un argument
|
| 509 |
// qui nous donne la "genealogie" de la carte que l'on doit afficher
|
513 |
// qui nous donne la "genealogie" de la carte que l'on doit afficher
|
| 510 |
else if ($this->historique_cartes) {
|
514 |
else if ($this->historique_cartes) {
|
| 511 |
// Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
|
515 |
// Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
|
| 512 |
$historique_cartes = explode('*',$this->historique_cartes);
|
516 |
$historique_cartes = explode('*',$this->historique_cartes);
|
| - |
|
517 |
|
| 513 |
foreach ($historique_cartes as $key => $value) {
|
518 |
foreach ($historique_cartes as $key => $value) {
|
| 514 |
if ($key != 0) {
|
519 |
if ($key != 0) {
|
| 515 |
$this = $this->fils[$value];
|
520 |
$this = $this->fils[$value];
|
| 516 |
}
|
521 |
}
|
| 517 |
}
|
522 |
}
|
| Line 555... |
Line 560... |
| 555 |
$retour = '';
|
560 |
$retour = '';
|
| Line 556... |
Line 561... |
| 556 |
|
561 |
|
| 557 |
$requete =
|
562 |
$requete =
|
| 558 |
'SELECT '.$this->_info_table_zg['nom_chp_id_zone'].', '.$this->_info_table_zg['nom_chp_nom_zone'].
|
563 |
'SELECT '.$this->_info_table_zg['nom_chp_id_zone'].', '.$this->_info_table_zg['nom_chp_nom_zone'].
|
| 559 |
' FROM '.$this->_info_table_zg['nom_table_zone'];
|
564 |
' FROM '.$this->_info_table_zg['nom_table_zone'];
|
| 560 |
if ($this->_info_table_zg['nom_chp_zone_sup'] != ''){
|
565 |
if ($this->_info_table_zg['nom_chp_zone_sup'] != '' && $this->_id_zone_geo_carte != ''){
|
| 561 |
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
|
566 |
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
|
| 562 |
$requete .=
|
567 |
$requete .=
|
| 563 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = "'.$this->_id_zone_geo_carte.'"';
|
568 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = "'.$this->_id_zone_geo_carte.'"';
|
| 564 |
}
|
569 |
}
|
| Line 567... |
Line 572... |
| 567 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
|
572 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
|
| 568 |
}
|
573 |
}
|
| 569 |
}
|
574 |
}
|
| 570 |
$requete .=
|
575 |
$requete .=
|
| 571 |
' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
|
576 |
' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
|
| 572 |
$resultat = mysql_query ($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__,
|
577 |
$resultat = $GLOBALS['ins_db']->query ($requete) ;
|
| 573 |
'', $requete));
|
578 |
if (DB::isError($resultat)) {
|
| - |
|
579 |
echo BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete) ;
|
| - |
|
580 |
}
|
| 574 |
|
581 |
|
| 575 |
$i=0;
|
582 |
$i=0;
|
| Line 576... |
Line 583... |
| 576 |
|
583 |
|
| 577 |
$retour = '<select name="liste_zone_carte" style="float:right;" onchange="javascript:this.form.submit();">'."\n";
|
584 |
$retour = '<select name="liste_zone_carte" style="float:right;" onchange="javascript:this.form.submit();">'."\n";
|
| Line 578... |
Line 585... |
| 578 |
$retour .= '<option value="">'.INS_VISUALISER_ZONE.'</option>'."\n";
|
585 |
$retour .= '<option value="">'.INS_VISUALISER_ZONE.'</option>'."\n";
|
| 579 |
|
586 |
|
| Line 580... |
Line 587... |
| 580 |
$nom_chp_nom_zone = $this->_info_table_zg['nom_chp_nom_zone'];
|
587 |
$nom_chp_nom_zone = $this->_info_table_zg['nom_chp_nom_zone'];
|
| 581 |
$nom_chp_id_zone = $this->_info_table_zg['nom_chp_id_zone'];
|
588 |
$nom_chp_id_zone = $this->_info_table_zg['nom_chp_id_zone'];
|
| 582 |
|
589 |
|
| 583 |
while ($ligne = mysql_fetch_object ($resultat)) {
|
590 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
| 584 |
if ($zone_par_defaut == $ligne->$nom_chp_id_zone){
|
591 |
if ($zone_par_defaut == $ligne->$nom_chp_id_zone){
|
| 585 |
$retour .= '<option value="'.$ligne->$nom_chp_id_zone.'" selected="selected">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
|
592 |
$retour .= '<option value="'.$ligne->$nom_chp_id_zone.'" selected="selected">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
|
| Line 634... |
Line 641... |
| 634 |
//un tableau d'objets Carto_InformationCouleur (voir la description de la classe ci-dessus.
|
641 |
//un tableau d'objets Carto_InformationCouleur (voir la description de la classe ci-dessus.
|
| Line 635... |
Line 642... |
| 635 |
|
642 |
|
| 636 |
$requete_01 =
|
643 |
$requete_01 =
|
| 637 |
'SELECT *'.
|
644 |
'SELECT *'.
|
| 638 |
' FROM '.$table_zone_geo;
|
645 |
' FROM '.$table_zone_geo;
|
| 639 |
if ($chp_zone_sup != ''){
|
646 |
if ($chp_zone_sup != '' && $this->_id_zone_geo_carte != ''){
|
| 640 |
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
|
647 |
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
|
| 641 |
$requete_01 .=
|
648 |
$requete_01 .=
|
| 642 |
' WHERE '.$chp_zone_sup.' = "'.$this->_id_zone_geo_carte.'"';
|
649 |
' WHERE '.$chp_zone_sup.' = "'.$this->_id_zone_geo_carte.'"';
|
| 643 |
}
|
650 |
}
|
| Line 790... |
Line 797... |
| 790 |
{
|
797 |
{
|
| 791 |
// Nous récupérons le nombre de couleur différentes contenues dans l'image.
|
798 |
// Nous récupérons le nombre de couleur différentes contenues dans l'image.
|
| 792 |
//echo $this->fond.'<BR>';
|
799 |
//echo $this->fond.'<BR>';
|
| 793 |
$image_fond = imagecreatefrompng($this->fond);
|
800 |
$image_fond = imagecreatefrompng($this->fond);
|
| 794 |
$taille_palette = imagecolorstotal ($image_fond);
|
801 |
$taille_palette = imagecolorstotal ($image_fond);
|
| 795 |
if (!$image_fond) echo 'erreur fond : '.$this->fond;
|
802 |
if (!$image_fond) echo 'erreur fond';
|
| 796 |
// Pour chaque couleur contenue dans l'image, nous cherchons l'objet correspondant
|
803 |
// Pour chaque couleur contenue dans l'image, nous cherchons l'objet correspondant
|
| 797 |
// dans le tableau $att, qui contient des informations sur chaque zone de l'image,
|
804 |
// dans le tableau $att, qui contient des informations sur chaque zone de l'image,
|
| 798 |
// et nous attribuons à l'objet la valeur de l'index de sa couleur dans l'image.
|
805 |
// et nous attribuons à l'objet la valeur de l'index de sa couleur dans l'image.
|
| Line 799... |
Line 806... |
| 799 |
|
806 |
|