Subversion Repositories Applications.papyrus

Rev

Rev 1139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1139 Rev 1292
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.6 2006-12-12 10:37:45 alexandre_tb Exp $
32
// $Id: lib.carto.php,v 1.7 2007-04-06 08:35:46 neiluj Exp $
33
// FICHIER : $RCSfile: lib.carto.php,v $
33
// FICHIER : $RCSfile: lib.carto.php,v $
34
// AUTEUR  : $Author: alexandre_tb $
34
// AUTEUR  : $Author: neiluj $
35
// VERSION : $Revision: 1.6 $
35
// VERSION : $Revision: 1.7 $
36
// DATE    : $Date: 2006-12-12 10:37:45 $
36
// DATE    : $Date: 2007-04-06 08:35:46 $
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
            $GLOBALS['ins_url']->addQueryString('historique_cartes', $chemin);
101
            
102
            $res.='href="'.$GLOBALS['ins_url']->getURL().'">&nbsp;'.$this->caractere_separation.'&nbsp;'.$tabnom[$key].'</a>';
102
            $res.='href="'.$this->url.'&amp;historique_cartes='.$chemin.'">&nbsp;'.$this->caractere_separation.'&nbsp;'.$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 {
-
 
206
        	return array ('type_action' => 'Recharger');
204
            return $action;
207
        }
205
        }
Line 208... Line 206...
208
    }//Fin de la méthode _consulterActionImage().
206
    }//Fin de la méthode _consulterActionImage().
209
    
207
    
Line 317... Line 315...
317
        $this->masque = $chemin.$masque;
315
        $this->masque = $chemin.$masque;
318
        $this->fond = $chemin.$fond;
316
        $this->fond = $chemin.$fond;
319
        $this->chemin = $chemin;
317
        $this->chemin = $chemin;
320
        $this->_info_table_zg = $info_table;
318
        $this->_info_table_zg = $info_table;
Line 321... Line -...
321
        
-
 
322
        
319
        
323
        $this->_action = new Carto_Action($info_table['nom_table_zone'],$info_table['nom_chp_id_zone'], 
-
 
324
        									$info_table['nom_chp_rouge'], $info_table['nom_chp_vert'], $info_table['nom_chp_bleu'],
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'],
325
                                                            'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone', 
-
 
326
											'CA_Action', 'CA_ID_Carte_destination');
321
                                                            'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone', 'CA_Action', 'CA_ID_Carte_destination');
327
        $this->fils = array();
322
        $this->fils = array();
328
        $this->filiation = $id;
323
        $this->filiation = $id;
329
        $this->historique_cartes = '';
324
        $this->historique_cartes = '';
330
        $this->liste_zone_carte = '';
325
        $this->liste_zone_carte = '';
Line 403... Line 398...
403
    //      -soit false.
398
    //      -soit false.
404
    //**********************************************************************************************************
399
    //**********************************************************************************************************
Line 405... Line 400...
405
    
400
    
406
    function donnerFormulaireImage ()
401
    function donnerFormulaireImage ()
-
 
402
    {
407
    {
403
        global $GS_GLOBAL;
Line 408... Line 404...
408
        $res = '';
404
        $res = '';
409
        
405
        
410
        // Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
406
        // Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
Line 445... Line 441...
445
            }
441
            }
Line 446... Line 442...
446
            
442
            
Line 447... Line 443...
447
            // on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
443
            // on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
448
           
444
           
449
            $action = $this->_action->_consulterActionImage($this->image_x, $this->image_y, $this->masque, $this->id);
445
            $action = $this->_action->_consulterActionImage($this->image_x, $this->image_y, $this->masque, $this->id);
450
           
446
            
451
            // Nous distinguons 2 cas :
447
            // Nous distinguons 2 cas :
Line 452... Line 448...
452
            //le cas ou il faut afficher une nouvelle carte ... :
448
            //le cas ou il faut afficher une nouvelle carte ... :
453
            if ($action['type_action'] == 'Aller_a') {
449
            if ($action['type_action'] == 'Aller_a') {
454
                
-
 
455
                $id_carte_destination = $action['id_carte_destination'] ;
450
                
456
                $this->fils[$id_carte_destination]->liste_zone_carte = $this->liste_zone_carte;
-
 
457
                if (INS_AFFICHE_ZONE_ROUGE) {
451
                $id_carte_destination = $action['id_carte_destination'] ;
458
                	$res .= ''.$this->fils[$id_carte_destination]->_donnerListeZoneCarte()."<br />\n";
452
                $this->fils[$id_carte_destination]->liste_zone_carte = $this->liste_zone_carte;
459
                }
453
                $res .= ''.$this->fils[$id_carte_destination]->_donnerListeZoneCarte()."<br />\n";
460
                $res .= '<input type="image" src="';
454
                $res .= '<input type="image" src="';
461
                $id_image = $this->_donnerIdUnique();
455
                $id_image = $this->_donnerIdUnique();
Line 469... Line 463...
469
            //Dans le cas où l'on veut rappeler une nouvelle carte, il se peut que la nouvelle carte à rappeler
463
            //Dans le cas où l'on veut rappeler une nouvelle carte, il se peut que la nouvelle carte à rappeler
470
            //soit la même que précédement.
464
            //soit la même que précédement.
471
            //Cette possibilité peut se présenter quand on clique sur un zone blanche d'une carte (càd dans la mer)
465
            //Cette possibilité peut se présenter quand on clique sur un zone blanche d'une carte (càd dans la mer)
472
            //Là, on recharge la carte précédente :
466
            //Là, on recharge la carte précédente :
473
            elseif ($action['type_action'] == 'Recharger') {
467
            elseif ($action['type_action'] == 'Recharger') {
474
                if (INS_AFFICHE_ZONE_ROUGE) {
-
 
475
                	$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
468
                $res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
476
                }
-
 
477
                $res .= '<input type="image" src="';
469
                $res .= '<input type="image" src="';
478
                $id_image = $this->_donnerIdUnique();
470
                $id_image = $this->_donnerIdUnique();
479
                $this->_lancerColoriage($id_image);
471
                $this->_lancerColoriage($id_image);
480
                $obj = serialize($this);
472
                $obj = serialize($this);
481
                $_SESSION['carte'] = $obj ;
473
                $_SESSION['carte'] = $obj ;
Line 497... Line 489...
497
                if ($key != 0) {
489
                if ($key != 0) {
498
                    $this = $this->fils[$value];
490
                    $this = $this->fils[$value];
499
                }
491
                }
500
            }
492
            }
501
            $this->liste_zone_carte = $liste_zone_carte;
493
            $this->liste_zone_carte = $liste_zone_carte;
502
            if (INS_AFFICHE_ZONE_ROUGE) {
-
 
-
 
494
            
503
            	$res .= ''.$this->_donnerListeZoneCarte($this->liste_zone_carte)."<br />\n";
495
            $res .= ''.$this->_donnerListeZoneCarte($this->liste_zone_carte)."<br />\n";
504
            }
-
 
505
            $res .= '<input type="image" src="';
496
            $res .= '<input type="image" src="';
506
            $id_image = $this->_donnerIdUnique();
497
            $id_image = $this->_donnerIdUnique();
507
            $this->_lancerColoriage($id_image, '', $this->liste_zone_carte);
498
            $this->_lancerColoriage($id_image, '', $this->liste_zone_carte);
508
            $this->historique = $this->historique_cartes;
499
            $this->historique = $this->historique_cartes;
509
            $obj = serialize($this);
500
            $obj = serialize($this);
Line 512... Line 503...
512
        // On teste maintenant si l'on vient d'un lien. Si c'est le cas on a recu un argument 
503
        // On teste maintenant si l'on vient d'un lien. Si c'est le cas on a recu un argument 
513
        // qui nous donne la "genealogie" de la carte que l'on doit afficher 
504
        // qui nous donne la "genealogie" de la carte que l'on doit afficher 
514
        else if ($this->historique_cartes) {
505
        else if ($this->historique_cartes) {
515
            // Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
506
            // Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
516
            $historique_cartes = explode('*',$this->historique_cartes);
507
            $historique_cartes = explode('*',$this->historique_cartes);
517
            
-
 
518
            foreach ($historique_cartes as $key => $value) {
508
            foreach ($historique_cartes as $key => $value) {
519
                if ($key != 0) {
509
                if ($key != 0) {
520
                    $this = $this->fils[$value];
510
                    $this = $this->fils[$value];
521
                }
511
                }
522
            }
512
            }
523
            // une foit que l'on a charge le bon objet nous le colorions 
513
            // une foit que l'on a charge le bon objet nous le colorions 
524
            if (INS_AFFICHE_ZONE_ROUGE) {
-
 
525
            	$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
514
            $res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
526
            }
515
            
527
            $res .= '<input type="image" src="';
516
            $res .= '<input type="image" src="';
528
            $id_image = $this->_donnerIdUnique();
517
            $id_image = $this->_donnerIdUnique();
529
            $this->_lancerColoriage($id_image);
518
            $this->_lancerColoriage($id_image);
530
            $this->historique = $this->historique_cartes;
519
            $this->historique = $this->historique_cartes;
531
            $obj = serialize($this);
520
            $obj = serialize($this);
Line 533... Line 522...
533
        }
522
        }
534
        // Enfin si on ne vient pas d'une carte ou d'un lien c'est que l'on vient de l'onglet carto du menu
523
        // Enfin si on ne vient pas d'une carte ou d'un lien c'est que l'on vient de l'onglet carto du menu
535
        // et on affiche alors la premiere carte
524
        // et on affiche alors la premiere carte
536
        else {
525
        else {
537
            unset ($_SESSION['carte']) ;
526
            unset ($_SESSION['carte']) ;
538
            if (INS_AFFICHE_ZONE_ROUGE) {
-
 
539
            	$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
527
            $res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
540
            }
528
            
541
            $res .= '<input type="image" src="';
529
            $res .= '<input type="image" src="';
542
            $id_image = $this->_donnerIdUnique();
530
            $id_image = $this->_donnerIdUnique();
543
            $this->_lancerColoriage($id_image);
531
            $this->_lancerColoriage($id_image);
544
            $this->historique = $this->id;
532
            $this->historique = $this->id;
545
            $obj = serialize($this);
533
            $obj = serialize($this);
Line 560... Line 548...
560
        $retour = '';
548
        $retour = '';
Line 561... Line 549...
561
        
549
        
562
        $requete =
550
        $requete =
563
                    'SELECT '.$this->_info_table_zg['nom_chp_id_zone'].', '.$this->_info_table_zg['nom_chp_nom_zone'].
551
                    'SELECT '.$this->_info_table_zg['nom_chp_id_zone'].', '.$this->_info_table_zg['nom_chp_nom_zone'].
564
                    ' FROM '.$this->_info_table_zg['nom_table_zone'];
552
                    ' FROM '.$this->_info_table_zg['nom_table_zone'];
565
        if ($this->_info_table_zg['nom_chp_zone_sup'] != '' && $this->_id_zone_geo_carte != ''){
553
        if ($this->_info_table_zg['nom_chp_zone_sup'] != ''){
566
            if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
554
            if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
567
                $requete .=
555
                $requete .=
568
                    ' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = "'.$this->_id_zone_geo_carte.'"';
556
                    ' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = "'.$this->_id_zone_geo_carte.'"';
569
            }
557
            }
Line 572... Line 560...
572
                    ' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
560
                    ' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
573
            }
561
            }
574
        }
562
        }
575
        $requete .=
563
        $requete .=
576
                    ' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
564
                    ' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
577
		$resultat = $GLOBALS['ins_db']->query ($requete) ;
565
	$resultat = mysql_query ($requete) or die('
-
 
566
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
578
		if (DB::isError($resultat)) {
567
            '<b>Requete : </b>'.$requete.
579
        	echo  BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete) ;
568
            '<br/><br/><b>Erreur : </b>'.mysql_error());
580
    	}
-
 
581
 
569
        
582
        $i=0;
570
        $i=0;
Line 583... Line 571...
583
        
571
        
584
        $retour = '<select name="liste_zone_carte" style="float:right;" onchange="javascript:this.form.submit();">'."\n";
572
        $retour = '<select name="liste_zone_carte" style="float:right;" onchange="javascript:this.form.submit();">'."\n";
Line 585... Line 573...
585
        $retour .= '<option value="">'.INS_VISUALISER_ZONE.'</option>'."\n";
573
        $retour .= '<option value="">'.INS_VISUALISER_ZONE.'</option>'."\n";
586
        
574
        
Line 587... Line 575...
587
        $nom_chp_nom_zone = $this->_info_table_zg['nom_chp_nom_zone'];
575
        $nom_chp_nom_zone = $this->_info_table_zg['nom_chp_nom_zone'];
588
        $nom_chp_id_zone = $this->_info_table_zg['nom_chp_id_zone'];
576
        $nom_chp_id_zone = $this->_info_table_zg['nom_chp_id_zone'];
589
        
577
        
590
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
578
        while ($ligne = mysql_fetch_object ($resultat)) {
591
            if ($zone_par_defaut == $ligne->$nom_chp_id_zone){
579
            if ($zone_par_defaut == $ligne->$nom_chp_id_zone){
592
                $retour .= '<option value="'.$ligne->$nom_chp_id_zone.'" selected="selected">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
580
                $retour .= '<option value="'.$ligne->$nom_chp_id_zone.'" selected="selected">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
Line 641... Line 629...
641
        //un tableau d'objets Carto_InformationCouleur (voir la description de la classe ci-dessus.
629
        //un tableau d'objets Carto_InformationCouleur (voir la description de la classe ci-dessus.
Line 642... Line 630...
642
        
630
        
643
        $requete_01 =
631
        $requete_01 =
644
                    'SELECT *'.
632
                    'SELECT *'.
645
                    ' FROM '.$table_zone_geo;
633
                    ' FROM '.$table_zone_geo;
646
        if ($chp_zone_sup != '' && $this->_id_zone_geo_carte != ''){
634
        if ($chp_zone_sup != ''){
647
            if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
635
            if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
648
                $requete_01 .=
636
                $requete_01 .=
649
                    ' WHERE '.$chp_zone_sup.' = "'.$this->_id_zone_geo_carte.'"';
637
                    ' WHERE '.$chp_zone_sup.' = "'.$this->_id_zone_geo_carte.'"';
650
            }
638
            }
Line 1196... Line 1184...
1196
}
1184
}
Line 1197... Line 1185...
1197
 
1185
 
1198
//-- Fin du code source  ------------------------------------------------------------
1186
//-- Fin du code source  ------------------------------------------------------------
1199
/*
1187
/*
1200
* $Log: not supported by cvs2svn $
-
 
1201
* Revision 1.4  2006/04/04 12:23:05  florian
-
 
1202
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
-
 
1203
*
1188
* $Log: not supported by cvs2svn $
1204
* Revision 1.3  2005/12/07 14:59:14  alexandre_tb
1189
* Revision 1.3  2005/12/07 14:59:14  alexandre_tb
1205
* suppression d'un echo
1190
* suppression d'un echo
1206
*
1191
*
1207
* Revision 1.2  2005/11/24 16:17:52  florian
1192
* Revision 1.2  2005/11/24 16:17:52  florian