Changeset 15432 for extensions/Psli_BingMaps/include/guest.inc.php
- Timestamp:
- May 30, 2012, 7:57:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Psli_BingMaps/include/guest.inc.php
r14891 r15432 3 3 Plugin Name: Psli-BingMaps 4 4 Author: psli 5 Description: Admin function for plugin "Psli-BingMaps"6 5 */ 7 6 … … 18 17 $row = pwg_db_fetch_assoc($result); 19 18 $conf[PSLI_CONF_KEY] = $row['value']; 20 $query = '21 SELECT value22 FROM '.CONFIG_TABLE.'23 WHERE param = "'.PSLI_CONF_LAT.'";';24 $result = pwg_query($query);25 $row = pwg_db_fetch_assoc($result);26 $conf[PSLI_CONF_LAT] = $row['value'];27 $query = '28 SELECT value29 FROM '.CONFIG_TABLE.'30 WHERE param = "'.PSLI_CONF_LON.'";';31 $result = pwg_query($query);32 $row = pwg_db_fetch_assoc($result);33 $conf[PSLI_CONF_LON] = $row['value'];34 $query = '35 SELECT value36 FROM '.CONFIG_TABLE.'37 WHERE param = "'.PSLI_CONF_ZOOM.'";';38 $result = pwg_query($query);39 $row = pwg_db_fetch_assoc($result);40 $conf[PSLI_CONF_ZOOM] = $row['value'];41 $query = '42 SELECT value43 FROM '.CONFIG_TABLE.'44 WHERE param = "'.PSLI_CONF_CATEGORY.'";';45 $result = pwg_query($query);46 $row = pwg_db_fetch_assoc($result);47 $conf[PSLI_CONF_CATEGORY] = $row['value'];48 19 49 20 $conf['psli_already_done'] = false; … … 62 33 if (! (strpos($_SERVER['HTTP_USER_AGENT'],"MSIE 6.0") === FALSE)) 63 34 return $desc; 35 36 if (isset($page['category']['id'])) 37 { 38 $query = ' 39 SELECT id, lat, lon, zoom 40 FROM '.PSLI_MAPS_TABLE.' 41 WHERE id_category = '.$page['category']['id'].';'; 42 $result = pwg_query($query); 43 } 64 44 65 45 // First test album to control availabilty of the map 66 if ((isset($page['category']['id'])) and ( $page['category']['id'] == $conf[PSLI_CONF_CATEGORY]) and ($conf['psli_already_done'] == false))46 if ((isset($page['category']['id'])) and (pwg_db_num_rows($result) > 0) and ($conf['psli_already_done'] == false)) 67 47 { 68 48 // Set data for this map 49 $row = pwg_db_fetch_assoc($result); 50 $lon_initiale = $row['lon']; 51 $zoom_initiale = $row['zoom']; 52 $lat_initiale = $row['lat']; 53 $id_initiale = $row['id']; 54 69 55 // Language data 70 56 load_language('plugin.lang', PSLI_BINGMAPS_TEMPLATE_PATH); … … 82 68 <script> 83 69 psli_g_BingKey = "'.$conf[PSLI_CONF_KEY].'"; 84 psli_g_zoomInitial = '.$ conf[PSLI_CONF_ZOOM].';85 psli_g_MapCenter = new Microsoft.Maps.Location('.$ conf[PSLI_CONF_LAT].', '.$conf[PSLI_CONF_LON].')'."\n";70 psli_g_zoomInitial = '.$zoom_initiale.'; 71 psli_g_MapCenter = new Microsoft.Maps.Location('.$lat_initiale.', '.$lon_initiale.')'."\n"; 86 72 87 73 88 74 $query_entities = ' 89 SELECT id, lat, lon, zoomMin, zoomMax, action, title, id_category 90 FROM '.PSLI_ENTITIES_TABLE.';'; 75 SELECT e.id id, lat, lon, zoomMin, zoomMax, action, id_action, title, type 76 FROM '.PSLI_ENTITIES_TABLE.' e left join '.PSLI_ENTITIES_MAPS_TABLE.' j ON e.id = j.id_entity 77 WHERE j.id_map = '.$id_initiale.';'; 91 78 $result_entities = pwg_query($query_entities); 92 79 … … 100 87 // For each sub category 101 88 while ($entity = pwg_db_fetch_assoc($result_entities)) 102 { 103 $query_datapoint = ' 104 SELECT lat, lon 105 FROM '.PSLI_DATAPOINT_TABLE.' 106 WHERE id_entity = '.$entity['id'].' ORDER BY id;'; 107 $result_datapoint = pwg_query($query_datapoint); 108 if (pwg_db_num_rows($result_datapoint) > 0) 109 { 110 $desc_data .= 'var psli_t_Vertices'.$entity['id'].' = new Array();'."\n"; 111 while ($row = pwg_db_fetch_assoc($result_datapoint)) 89 { 90 if ($entity['id_action'] != 0) 91 { 92 if ($entity['type'] == 2) 112 93 { 113 $desc_data .= 'psli_t_Vertices'.$entity['id'].'.push(new Microsoft.Maps.Location('.$row['lat'].','.$row['lon'].'));'."\n"; 94 $query_datapoint = ' 95 SELECT lat, lon 96 FROM '.PSLI_DATAPOINT_TABLE.' 97 WHERE id_entity = '.$entity['id'].' ORDER BY id;'; 98 $result_datapoint = pwg_query($query_datapoint); 99 if (pwg_db_num_rows($result_datapoint) > 0) 100 { 101 $desc_data .= 'var psli_t_Vertices'.$entity['id'].' = new Array();'."\n"; 102 while ($row = pwg_db_fetch_assoc($result_datapoint)) 103 { 104 $desc_data .= 'psli_t_Vertices'.$entity['id'].'.push(new Microsoft.Maps.Location('.$row['lat'].','.$row['lon'].'));'."\n"; 105 } 106 $desc_data .= ' 107 var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Polygon(psli_t_Vertices'.$entity['id'].',{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});'."\n"; 108 109 $desc_function_mouse_over .= ' 110 function psli_MapsMouseOver_'.$entity['id'].' (e) { 111 document.getElementById("Coordonates").innerHTML = "'.l10n('Click to zoom on')." ".$entity['title'].'"; 112 }'."\n"; 113 } 114 114 } 115 else 116 { 117 $desc_data .= ' 118 var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location('.$entity['lat'].','.$entity['lon'].'));'."\n"; 119 120 $desc_function_mouse_over .= ' 121 function psli_MapsMouseOver_'.$entity['id'].' (e) { 122 document.getElementById("Coordonates").innerHTML = "'.l10n('Click to show pictures of')." ".$entity['title'].'"; 123 }'."\n"; 124 } 125 115 126 $desc_data .= ' 116 var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Polygon(psli_t_Vertices'.$entity['id'].',{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});'."\n"; 117 118 $desc_function_mouse_over .= ' 119 function psli_MapsMouseOver_'.$entity['id'].' (e) { 120 document.getElementById("Coordonates").innerHTML = "'.l10n('Cliquez pour zoomer sur').$entity['title'].'"; 121 }'."\n"; 122 } 123 else 124 { 125 $desc_data .= ' 126 var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location('.$entity['lat'].','.$entity['lon'].'));'."\n"; 127 128 $desc_function_mouse_over .= ' 129 function psli_MapsMouseOver_'.$entity['id'].' (e) { 130 document.getElementById("Coordonates").innerHTML = "'.l10n('Cliquez pour acceder aux photos').$entity['title'].'"; 131 }'."\n"; 132 } 127 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "mouseover", psli_MapsMouseOver_'.$entity['id'].'); 128 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "mouseout", psli_MapsMouseOut); 129 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "click", psli_MapsClick_'.$entity['id'].');'."\n"; 130 131 switch ($entity['action']) 132 { 133 case 1: 134 $desc_function_click .= ' 135 function psli_MapsClick_'.$entity['id'].' (e) { 136 psli_g_Map.setView({zoom:'.$entity['id_action'].', center: new Microsoft.Maps.Location('.$entity['lat'].', '.$entity['lon'].')}); 137 }'."\n"; 138 break; 139 case 2: 140 $desc_function_click .= ' 141 function psli_MapsClick_'.$entity['id'].' (e) { 142 document.location.href=\'index.php?/category/'.$entity['id_action'].'\'; 143 }'."\n"; 144 break; 145 case 3: 146 $desc_function_click .= ' 147 function psli_MapsClick_'.$entity['id'].' (e) { 148 document.location.href=\'picture.php?/'.$entity['id_action'].'\'; 149 }'."\n"; 150 break; 151 } 133 152 134 $desc_data .= ' 135 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "mouseover", psli_MapsMouseOver_'.$entity['id'].'); 136 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "mouseout", psli_MapsMouseOut); 137 Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "click", psli_MapsClick_'.$entity['id'].');'."\n"; 138 139 if ($entity['action'] == 0) 140 { 141 $desc_function_click .= ' 142 function psli_MapsClick_'.$entity['id'].' (e) { 143 document.location.href=\'index.php?/category/'.$entity['id_category'].'\'; 144 }'."\n"; 145 } 146 else 147 { 148 $desc_function_click .= ' 149 function psli_MapsClick_'.$entity['id'].' (e) { 150 psli_g_Map.setView({zoom:'.$entity['action'].', center: new Microsoft.Maps.Location('.$entity['lat'].', '.$entity['lon'].')}); 151 }'."\n"; 152 } 153 154 for ($i = $entity['zoomMin']; $i <= $entity['zoomMax']; $i++) 155 { 156 $desc_data .= 'psli_g_ZoomEntity['.($i - 1).'].push(psli_t_Child'.$entity['id'].');'."\n"; 153 for ($i = $entity['zoomMin']; $i <= $entity['zoomMax']; $i++) 154 { 155 $desc_data .= 'psli_g_ZoomEntity['.($i - 1).'].push(psli_t_Child'.$entity['id'].');'."\n"; 156 } 157 157 } 158 158 }
Note: See TracChangeset
for help on using the changeset viewer.