1 | <?php
|
---|
2 | /************************************************************************/
|
---|
3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
4 | /* by Luciano Apolito & Roberto Gigli */
|
---|
5 | /* http://www.eleonline.it */
|
---|
6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
7 | /************************************************************************/
|
---|
8 |
|
---|
9 | if (stristr(htmlentities($_SERVER['PHP_SELF']), "javascript.php")) {
|
---|
10 | Header("Location: ../index.php");
|
---|
11 | die();
|
---|
12 | }
|
---|
13 |
|
---|
14 | ##################################################
|
---|
15 | # Include funzioni javascript #
|
---|
16 | ##################################################
|
---|
17 | #timer per tema tour
|
---|
18 | # inizio rotazione
|
---|
19 | if (isset($_SESSION['ruota']))
|
---|
20 | {
|
---|
21 | ?>
|
---|
22 |
|
---|
23 | <script type="text/javascript" language="javascript">
|
---|
24 | <!--
|
---|
25 | function loadpage() {
|
---|
26 |
|
---|
27 | thetimer = setTimeout("changepage()", 20000);
|
---|
28 |
|
---|
29 |
|
---|
30 | }
|
---|
31 |
|
---|
32 | function changepage() {
|
---|
33 |
|
---|
34 | newlocation = "<?php echo "modules.php?csv=1&block=0&id_cons_gen=".$_GET['id_cons_gen']."&id_comune=".$_GET['id_comune']; ?>"
|
---|
35 | location = newlocation
|
---|
36 | }
|
---|
37 | // --></script>
|
---|
38 |
|
---|
39 | <?php
|
---|
40 | }
|
---|
41 | # fine rotazione
|
---|
42 | # googlemaps per sezioni
|
---|
43 | # variabili nel config.php
|
---|
44 | # gkey= chiave google reperibile per il proprio sito qui
|
---|
45 | # http://code.google.com/intl/it/apis/maps/signup.html
|
---|
46 | # googlemaps 1=attivo 2: disattivo
|
---|
47 | # funzione by eleonline.it
|
---|
48 | #########################################################
|
---|
49 |
|
---|
50 |
|
---|
51 | function googlemaps(){
|
---|
52 | global $dbi,$prefix,$id_comune,$googlemaps,$op,$gkey,$lang;
|
---|
53 | # recupera gli inidirizzi
|
---|
54 | $id_sede=$_GET['id_sede'];
|
---|
55 | $sql = mysql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ", $dbi);
|
---|
56 | list($comune) = mysql_fetch_row($sql);
|
---|
57 | $sql = mysql_query("select indirizzo from ".$prefix."_ele_sede where id_sede='$id_sede'", $dbi);
|
---|
58 | list($indirizzo)=mysql_fetch_row($sql);
|
---|
59 | $address="$indirizzo $comune";
|
---|
60 |
|
---|
61 | $url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address));
|
---|
62 | $result = false;
|
---|
63 |
|
---|
64 | if($result = file_get_contents($url)) {
|
---|
65 | $coords = array();
|
---|
66 |
|
---|
67 | if(strpos($result,'errortips') > 1 || strpos($result,'Did you mean:') !== false) {
|
---|
68 | return false;
|
---|
69 | }
|
---|
70 |
|
---|
71 | preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $result, $matches);
|
---|
72 |
|
---|
73 | $coords['lat'] = $matches[1];
|
---|
74 | $coords['long'] = $matches[2];
|
---|
75 | }
|
---|
76 |
|
---|
77 | echo '
|
---|
78 | <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&language=it"></script>
|
---|
79 | <script type="text/javascript">
|
---|
80 | function initialize() {
|
---|
81 | var latlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // centro della mappa
|
---|
82 | var myLatlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // segnapunto
|
---|
83 | // definizione della mappa
|
---|
84 | var myOptions = {
|
---|
85 | zoom: 16,
|
---|
86 | center: latlng,
|
---|
87 | mapTypeId: google.maps.MapTypeId.ROADMAP,
|
---|
88 | mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR}
|
---|
89 | }
|
---|
90 | mymap = new google.maps.Map(document.getElementById("map"), myOptions);
|
---|
91 | // definizione segnapunto
|
---|
92 | var marker = new google.maps.Marker({
|
---|
93 | position: myLatlng,
|
---|
94 | map: mymap,
|
---|
95 | title:"'.$address.'"
|
---|
96 | });
|
---|
97 |
|
---|
98 | }
|
---|
99 | </script>
|
---|
100 | ';
|
---|
101 | }
|
---|
102 | ?>
|
---|