aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-03-19 17:51:07 -0300
committerSilvio <silvio@socioambiental.org>2013-03-19 17:51:07 -0300
commit14b38ba821de3e19813c50f6b35621ba681d1f9c (patch)
tree7c40e4bba93c041f9d48116f6c44bbc8a5bc851a
parentf2e1e7d673f93d33c3df088af7d08f142d56fe1c (diff)
downloadgmap_arcgis-14b38ba821de3e19813c50f6b35621ba681d1f9c.tar.gz
gmap_arcgis-14b38ba821de3e19813c50f6b35621ba681d1f9c.tar.bz2
Coding style
-rw-r--r--gmap_arcgis.module176
1 files changed, 87 insertions, 89 deletions
diff --git a/gmap_arcgis.module b/gmap_arcgis.module
index 1a73928..9e458f6 100644
--- a/gmap_arcgis.module
+++ b/gmap_arcgis.module
@@ -20,54 +20,54 @@ function gmap_arcgis_perm() {
* Implementation of hook_gmap().
*/
function gmap_arcgis_gmap($op, &$map) {
- if ($op == 'pre_theme_map') {
- /**
- * Use $map to change and add custom overlays into
- * a given map instance.
- */
- if (isset($map['arcgis'])) {
- global $base_url;
-
- /**
- * Make sure that shapes js code are loaded.
- *
- * This is needed as a workaround to the current GMap
- * module that doesn't add shapes js if $map['shapes']
- * wasn't previously defined.
- */
- if (!empty($map['shapes'])) {
- $gmap_path = drupal_get_path('module', 'gmap') . '/js/';
- drupal_add_js($gmap_path . 'shapeloader_static.js');
- drupal_add_js($gmap_path . 'gmap_shapes.js');
- }
-
- /**
- * The order to load the following js code is important.
- */
- // Add Google js API
- $key = variable_get('gmap_api_key', '');
- $script = '<script type="text/javascript" ';
- drupal_set_html_head($script . 'src="http://www.google.com/jsapi?key=' . $key . '&sensor=true&language=pt-BR"></script>');
-
- // Add ArcGIS js API
- drupal_set_html_head($script . 'src="'. $base_url .'/sites/all/libraries/google-maps-utility-library-v3/arcgislink/src/arcgislink_compiled.js"></script>');
-
- // Setup Map Id
- drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting');
-
- // Add custom js
- $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') . '/';
- drupal_add_js($gmap_arcgis_path . 'gmap_arcgis.js');
- //jquery_ui_add('ui.dialog');
- jquery_ui_add('effects.fold');
- jquery_ui_add('effects.explode');
- jquery_ui_add('effects.core');
- jquery_ui_add('ui.slider');
-
- $path_ui_css = drupal_get_path('module', 'jquery_ui');
- drupal_add_css($path_ui_css . '/jquery.ui/themes/default/ui.all.css');
- }
+ if ($op == 'pre_theme_map') {
+ /**
+ * Use $map to change and add custom overlays into
+ * a given map instance.
+ */
+ if (isset($map['arcgis'])) {
+ global $base_url;
+
+ /**
+ * Make sure that shapes js code are loaded.
+ *
+ * This is needed as a workaround to the current GMap
+ * module that doesn't add shapes js if $map['shapes']
+ * wasn't previously defined.
+ */
+ if (!empty($map['shapes'])) {
+ $gmap_path = drupal_get_path('module', 'gmap') . '/js/';
+ drupal_add_js($gmap_path . 'shapeloader_static.js');
+ drupal_add_js($gmap_path . 'gmap_shapes.js');
+ }
+
+ /**
+ * The order to load the following js code is important.
+ */
+ // Add Google js API
+ $key = variable_get('gmap_api_key', '');
+ $script = '<script type="text/javascript" ';
+ drupal_set_html_head($script . 'src="http://www.google.com/jsapi?key=' . $key . '&sensor=true&language=pt-BR"></script>');
+
+ // Add ArcGIS js API
+ drupal_set_html_head($script . 'src="'. $base_url .'/sites/all/libraries/google-maps-utility-library-v3/arcgislink/src/arcgislink_compiled.js"></script>');
+
+ // Setup Map Id
+ drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting');
+
+ // Add custom js
+ $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') . '/';
+ drupal_add_js($gmap_arcgis_path . 'gmap_arcgis.js');
+ //jquery_ui_add('ui.dialog');
+ jquery_ui_add('effects.fold');
+ jquery_ui_add('effects.explode');
+ jquery_ui_add('effects.core');
+ jquery_ui_add('ui.slider');
+
+ $path_ui_css = drupal_get_path('module', 'jquery_ui');
+ drupal_add_css($path_ui_css . '/jquery.ui/themes/default/ui.all.css');
}
+ }
}
/**
@@ -75,25 +75,22 @@ function gmap_arcgis_gmap($op, &$map) {
* @param array $marker
*/
function add_title_on_marker(&$marker) {
- if (!empty($marker['text'])) {
- $dom = new DOMDocument();
- $dom->loadHTML($marker['text']);
- //$dom->preserveWhiteSpace = false;
-
- $divs = $dom->getElementsByTagName('div');
- if ($divs) {
- foreach ($divs AS $div) {
-
- if ($div->getAttribute('id') === 'nid') {
-
- $x = node_load($div->nodeValue);
-
- $titulo = $x->field_categoria[0]['value'] . ' ' . $x->field_preposicao[0]['value'] . ' ' . $x->title;
- $marker['opts'] = array('title' => $titulo, 'nid' => $div->nodeValue, 'category' => 'marker_uc');
- }
- }
+ if (!empty($marker['text'])) {
+ $dom = new DOMDocument();
+ $dom->loadHTML($marker['text']);
+ //$dom->preserveWhiteSpace = false;
+ $divs = $dom->getElementsByTagName('div');
+
+ if ($divs) {
+ foreach ($divs AS $div) {
+ if ($div->getAttribute('id') === 'nid') {
+ $x = node_load($div->nodeValue);
+ $titulo = $x->field_categoria[0]['value'] .' '. $x->field_preposicao[0]['value'] . ' ' . $x->title;
+ $marker['opts'] = array('title' => $titulo, 'nid' => $div->nodeValue, 'category' => 'marker_uc');
}
+ }
}
+ }
}
/**
@@ -101,41 +98,42 @@ function add_title_on_marker(&$marker) {
* @param array marker
*/
function __addMarker(&$map, $data) {
- $map['markers'][] = array(
- 'latitude' => $data['latitude'],
- 'longitude' => $data['longitude'],
- 'markername' => $data['markername'],
- 'offset' => $data['offset'],
- 'text' => $data['body'],
- 'opts' => array(
- 'title' => $data['title'],
- 'nid' => $data['nid'],
- 'category' => $data['category'],
- ),
- );
+ $map['markers'][] = array(
+ 'latitude' => $data['latitude'],
+ 'longitude' => $data['longitude'],
+ 'markername' => $data['markername'],
+ 'offset' => $data['offset'],
+ 'text' => $data['body'],
+ 'opts' => array(
+ 'title' => $data['title'],
+ 'nid' => $data['nid'],
+ 'category' => $data['category'],
+ ),
+ );
}
/**
* Implementation of hook_block()
*/
function gmap_arcgis_block($op='list', $delta=0, $edit=array()) {
- global $map;
- switch ($op) {
- case 'list':
- $blocks[0]['info'] = t('Protected areas list');
- return $blocks;
+ global $map;
- case 'view':
- $blocks['subject'] = t('Protected areas list');
- $blocks['content'] = drupal_get_form('uc_form') .
- '<div id="abrefecha" class="close_gmap_arcgis"><a href="javascript:void(0)" id="clickmapa" title="Temas">X</a></div>';
+ switch ($op) {
+ case 'list':
+ $blocks[0]['info'] = t('Protected areas list');
+ return $blocks;
- return $blocks;
+ case 'view':
+ $blocks['subject'] = t('Protected areas list');
+ $blocks['content'] = drupal_get_form('uc_form') .
+ '<div id="abrefecha" class="close_gmap_arcgis"><a href="javascript:void(0)" id="clickmapa" title="Temas">X</a></div>';
- case 'configure':
+ return $blocks;
- case 'save':
- }
+ case 'configure':
+
+ case 'save':
+ }
}
// TODO: move to isa_gmap_overlays