diff options
| -rw-r--r-- | gmap_arcgis.info | 2 | ||||
| -rw-r--r-- | gmap_arcgis.js | 52 | ||||
| -rw-r--r-- | gmap_arcgis.module | 573 | 
3 files changed, 541 insertions, 86 deletions
diff --git a/gmap_arcgis.info b/gmap_arcgis.info index 98b608c..81bd643 100644 --- a/gmap_arcgis.info +++ b/gmap_arcgis.info @@ -4,3 +4,5 @@ description = Integrates ArcGIS Layers with GMap.  core = 6.x  version = "6.x-0.1"  dependencies[] = gmap +dependencies[] = jquery_ui + diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 0f34921..9960f94 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -4,7 +4,7 @@  google.load("maps", "2.x");  // Global variables -var map, mapExtension, gOverlays; +var map, mapExtension, gOverlays,markers,pol;  // Setup custom GMap Overlays (layers and labels)  function gmap_arcgis() { @@ -19,7 +19,7 @@ function gmap_arcgis() {      var fields   = new Array();      var id       = 'auto1map';      var content, label; -   +         // Get data from Drupal      if (Drupal.settings.gmap_arcgis !== undefined) {        // Get array of polygons @@ -35,6 +35,8 @@ function gmap_arcgis() {          id = Drupal.settings.gmap_arcgis.id;        }      } + +         // Get an existing GMap instance using Drupal GMap Module API      // and add an ArcGIS extension to it @@ -47,7 +49,7 @@ function gmap_arcgis() {        fields  = ["id", "name"];        content = 'Placeholder';        icon    = new GIcon(G_DEFAULT_ICON); -   +        if (label[1] !== undefined) {          // Set custom fields          fields = [ label[1][0], label[1][1] ]; @@ -72,10 +74,15 @@ function gmap_arcgis() {        showLabels(label[0], fields, content, icon);      } -    for (var j = 0; j < polygons.length; j++) { -      showPolygons(polygons[j]); +    for (j = 0; j < polygons.length; j++) { +         +      showPolygons(polygons[j]);          } -  }, 500); +    +     +     +  }, 5); +  //setTimeout($.unblockUI, 10000);  }  // Add labels from a given ArcGIS MapServer Layer @@ -104,7 +111,8 @@ function showLabelsCallback(fields, content, icon) {    return function(fset) {      // Label title      var title = '{' + fields[1] + '}'; - +     +          // JS literal class esri.arcgis.gmaps.MarkerOptions      var myMarkerOptions = { title:title, icon:icon }; @@ -120,12 +128,15 @@ function showLabelsCallback(fields, content, icon) {  // Add polygons from a given ArcGIS MapServer Layer  function showPolygons(uri) { -  polygons = new esri.arcgis.gmaps.DynamicMapServiceLayer(uri, null, 0.45, showPolygonsCallback); +  pol = new esri.arcgis.gmaps.DynamicMapServiceLayer(uri, null, 0.55); + +  GEvent.addListener(pol,"load",function(g){ map.addOverlay(g);setTimeout($.unblockUI, 6000);}); +    }  // Callback for showPolygons  function showPolygonsCallback(mapservicelayer, error) { -  map.addOverlay(mapservicelayer); +      map.addOverlay(mapservicelayer);  }  // Add custom marker @@ -133,11 +144,12 @@ function createMarker(point, name, html, icone) {    var icon              = new GIcon();    icon.image            = icone;    icon.shadow           = "http://maps.google.com/mapfiles/ms/micons/msmarker.shadow.png"; -  icon.iconSize         = new GSize(12, 20); +  icon.iconSize         = new GSize(20, 20);    icon.shadowSize       = new GSize(22, 20);    icon.iconAnchor       = new GPoint(6, 20);    icon.infoWindowAnchor = new GPoint(5, 1); +    var marker = new GMarker(point);    GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });    return marker; @@ -145,5 +157,25 @@ function createMarker(point, name, html, icone) {  // Add map overlays  $(document).ready(function() { +  //showOverlay(13000);    google.setOnLoadCallback(gmap_arcgis); +  $('#edit-lista-uc').change(function() { +      oelem = $("option:selected", this).val(); +      marcador = Drupal.gmap.getMap('auto1map').vars.markers[oelem]; +      GEvent.trigger(marcador.marker,"click"); +      $('#header').hide(); +      $('#nav').hide(); +       +      //get(Drupal.gmap.getMap('auto1map').vars.behavior);  +       +  }); + +  //$('auto1map').append('<div>oi oi oi</div>'); +    }); + +$(document).ready(function() { +  $("#uc-form").show(); + +}); + diff --git a/gmap_arcgis.module b/gmap_arcgis.module index fc68938..9a71980 100644 --- a/gmap_arcgis.module +++ b/gmap_arcgis.module @@ -1,4 +1,5 @@  <?php +  // $Id$  /** @@ -9,84 +10,504 @@   */  /** + * Implementation of hook_perm() + */ +function gmap_arcgis_perm() { +  return array('access gmap_arcgis content'); +} + + +/**   * 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'])) { -      /** -       * 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('googlemap_api_key', ''); -      $script = '<script type="text/javascript" '; -      drupal_set_html_head($script .'src="http://www.google.com/jsapi?key='. $key .'"></script>'); - -      // Add ArcGIS js API -      drupal_set_html_head($script .'src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.4"></script>'); - -      // Setup Map Id -      drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting'); - -      /** -       * Setup polygons and labels. Labels have the following format: -       * -       *   $map['arcgis']['labels'] = array($layer1 [, $layer2 [,... $layerN]]); -       * -       * Where $layer is -       * -       *   $layer = array($layer_uri, $fields, $content, $icon); -       * -       * Where $layer_uri is a MapService layer, $fields is an array with -       * a pair of layer fields to pass to the query, $content is a string -       * with the content to display for each marker and $icon is an array -       * with parameteres from a GIcon class -       * -       *   $icon = array($shadow, $image, $info_size, $shadow_size, -       *                 $info_anchor, $info_window_anchor); -       * -       * For more info on the GIcon class, see -       * http://code.google.com/intl/pt-BR/apis/maps/documentation/reference.html#GIcon -       * -       * Example: -       * -       *   $labels = array( -       *       array("http://mapservice/layer1", array('id', 'name'), array( -       *           NULL, 'http://path/to/icon.png', -       *           array(20, 34), array(37, 34), array(9, 34), array(9, 2) -       *           ) -       *         ), -       *       array("http://mapservice/layer2"), -       *   ); -       */ -      if (isset($map['arcgis']['polygons'])) { -        drupal_add_js(array('gmap_arcgis' => array('polygons' => $map['arcgis']['polygons'])), 'setting'); -      } -      if (isset($map['arcgis']['labels'])) { -        drupal_add_js(array('gmap_arcgis' => array('labels'   => $map['arcgis']['labels'])),   'setting'); -      } - -      // Add custom js -      $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') .'/'; -      drupal_add_js($gmap_arcgis_path .'gmap_arcgis.js'); +    if ($op == 'pre_theme_map') { + + +        /** +         * Use $map to change and add custom overlays into +         * a given map instance. +         */ +        if (isset($map['arcgis'])) { +            /** +             * 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('googlemap_api_key', ''); +            $script = '<script type="text/javascript" '; +            drupal_set_html_head($script . 'src="http://www.google.com/jsapi?key=' . $key . '"></script>'); + +            // Add ArcGIS js API +            drupal_set_html_head($script . 'src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6"></script>'); + +            // Setup Map Id +            drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting'); + + +            /** +             * Setup polygons and labels. Labels have the following format: +             * +             *   $map['arcgis']['labels'] = array($layer1 [, $layer2 [,... $layerN]]); +             * +             * Where $layer is +             * +             *   $layer = array($layer_uri, $fields, $content, $icon); +             * +             * Where $layer_uri is a MapService layer, $fields is an array with +             * a pair of layer fields to pass to the query, $content is a string +             * with the content to display for each marker and $icon is an array +             * with parameteres from a GIcon class +             * +             *   $icon = array($shadow, $image, $info_size, $shadow_size, +             *                 $info_anchor, $info_window_anchor); +             * +             * For more info on the GIcon class, see +             * http://code.google.com/intl/pt-BR/apis/maps/documentation/reference.html#GIcon +             * +             * Example: +             * +             *   $labels = array( +             *       array("http://mapservice/layer1", array('id', 'name'), array( +             *           NULL, 'http://path/to/icon.png', +             *           array(20, 34), array(37, 34), array(9, 34), array(9, 2) +             *           ) +             *         ), +             *       array("http://mapservice/layer2"), +             *   ); +             */ +            /** +             * The code below provides titles on markers +             */ +            // if(is_array($map['markers'])) { +            //   array_walk($map['markers'], 'add_title_on_marker'); +            // } + + +            if (isset($map['arcgis']['polygons'])) { +                drupal_add_js(array('gmap_arcgis' => array('polygons' => $map['arcgis']['polygons'])), 'setting'); +            } +            if (isset($map['arcgis']['labels'])) { +                drupal_add_js(array('gmap_arcgis' => array('labels' => $map['arcgis']['labels'])), 'setting'); +            } + +            /* $map['markers'][] = array( +              'latitude'      =>  '-22.7559207', +              'longitude'     => '-48.1640625', +              'markername'    => 'Eventos', +              'offset'        => 0, +              'text'          => 'Um teste', +              'opts'          => array( +              'title'     => 'Teste de evento', +              'nid'       => 10853, +              'category'  => 'marker_uc', +              ), + +              ); */ + +            // print views_embed_view('eventos'); +            /* +              $my_content_view = views_get_view('eventos'); +              $my_content_view->build('default'); +              $my_content_view->execute('default'); + +              $results = $my_content_view->result; + + +              foreach($results AS $r) { + +              //Format the Body of the ballon +              $inicio = format_date($r->event_unix_event_start); +              $fim = format_date($r->event_unix_event_end); +              $body = '<div style="width:350px;height:250px;overflow:auto">'; +              $body .= "<h1>$r->node_title</h1>"; +              $body .= " +              <p> +              $r->node_revisions_body +              </p> +              <ul> +              <li> +              Data início: $inicio +              <li>Data fim $fim +              </ul> +              "; +              $body .= '</div>'; + + + + +              $data['latitude']   = $r->location_latitude; +              $data['longitude']  = $r->location_longitude; +              $data['title']      = $r->node_title; +              $data['offset']     = 0; +              $data['nid']        = $r->nid; +              $data['body']       = $body; +              $data['category']   = 'marker_uc'; + +              __addMarker(&$map, $data); + +              } */ + + +            // 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'); +             +            drupal_add_js('showOverlay();', 'inline', 'footer'); +        }      } -  }  } + +/** + * Set the title of the marker; + * @param array $marker + */ +function add_title_on_marker(&$marker) { + +    if (!empty($marker['text'])) { +        $dom = new DOMDocument(); +        $dom->loadHTML($marker['text']); +        //$dom->preserveWhiteSpace = false; +        // print_r($marker['text']); + +        $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'); +                } +            } +        } +    } +} + +/** + * Wrapper to add custom markers on map. Need to be out somewhere + * @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'], +        ), +    ); +} + +/** + * Implementation of hook_form() + */ +function uc_form($form_state) { + +    $text = t('Choose a protected area on the list below'); + +    $view = views_get_view('mapa'); + +    //$view->execute('default'); + +    $view->execute_display('default'); +    //firep($view->result, 'lsita de uc'); + +    $i = 0; +    $opcoes[-1] = $text; + +    foreach ($view->result AS $res) { + +        $opcoes[$i] = $res->node_title . ' (' . $res->node_data_field_categoria_field_categoria_value . ')'; +        $i++; +    } + +    asort($opcoes); + +    $form['div_tag'] = array( +        '#type' => 'markup', +        '#value' => '<div><label for="slider" id="lslider">' . t('Cumulative deforestation from 2000 to 2009.') . '</label></div><div id="ruler"><div id="slider"></div></div>', +        '#weight' => -5, +    ); //<span id="yy"></span> + +    $form['markers'] = array( +        '#type' => 'checkbox', +        '#prefix' => '<div id="hideshow-limits">', +        '#title' => t('Conservational Units markers'), +        '#suffix' => '<a href="javascript:void(0)" title="' . t('show/hide limits') . '" id="edit-ucs" class="limits-on"></a> </div>', +        '#default_value' => 1, +        '#weight' => -4, +    ); + +    /* $form['ucs'] = array( +      '#type' => 'checkbox', +      '#title' => t('Conservational Units limits'), +      '#default_value' => 1, +      '#weight' => -3, +      ); */ +//[<a href="javascript:void(0)" id="#edit-markers">'.t('hide markers').'</a>] +    $form['tis'] = array( +        '#type' => 'checkbox', +        '#title' => t('Indigenous Lands'), +        '#weight' => -2, +    ); +    $form['focos'] = array( +        '#type' => 'checkbox', +        '#title' => t('Heat sources'), +        '#weight' => -1, +    ); + +    $form['energia'] = array( +        '#type' => 'checkbox', +        '#title' => t('Energy'), +        '#weight' => 0, +    ); + +    $form['cavernas'] = array( +        '#type' => 'checkbox', +        '#title' => t('Caves'), +        '#weight' => 1, +    ); + +    $form['mineracao'] = array( +        '#type' => 'checkbox', +        '#title' => t('Mining'), +        '#weight' => 2, +    ); + +    $form['biomas'] = array( +        '#type' => 'checkbox', +        '#title' => t('Biomes'), +        '#weight' => 3, +    ); + +    $form['fitofisionomia'] = array( +        '#type' => 'checkbox', +        '#title' => t('Vegetation'), +        '#weight' => 4, +    ); +    $form['baciashidrograficas'] = array( +        '#type' => 'checkbox', +        '#title' => t('Watersheds'), +        '#weight' => 5, +    ); + +    $form['ramsar'] = array( +        '#type' => 'checkbox', +        '#title' => t('Ramsar Sites'), +        '#weight' => 6, +    ); + + +    $form['lista_uc'] = array( +        '#type' => 'select', +        '#title' => $text, +        '#default_value' => array(-1, $text), +        '#options' => $opcoes, +        '#weight' => 7, +        '#attributes' => array('class' => 'selectmenu'), +    ); + + +    $form['div_tag2'] = array( +        '#type' => 'markup', +        '#value' => '<div id="legenda"><h1>' . t('Subtitles') . '</h1> +                           <ul> +                            +                           <span id="luc"> +                                <h2>' . t('Conservational Units') . '</h2> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/pi.png" width="11" height="11"> ' . t('Proteção Integral') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/us.png" width="11" height="11"> ' . t('Uso Sustentável') . '</li> +                            </span> +                            <h2 id="lti" class="hide legenda-cavernas"><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/ti.png"> ' . t('Indigenous Lands') . '</h2> +                             +                                <h2 id="lhs" class="hide"><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/focos.png" align="left"> ' . t('Heat sources last 24 hours') . '</h2> + +                                <span id="len"  class="hide"> +                                <h2 class="legenda-energia">' . t('Energy') . '</h2> +                                      <ul>' . t('Thermoelectric') . ' +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/planejada.png"> ' . t('Planned') . '</li> +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/em_construcao.png"> ' . t('Under Constrution / Grant') . '</li> +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/em_operacao.png"> ' . t('In operation') . '</li> + +                                      </ul> +                                      <ul>' . t('Hydropower') . ' +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/hidro_planejada.png"> ' . t('Planned') . '</li> +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/hidro_em_construcao.png"> ' . t('Under Constrution / Grant') . '</li> +                                            <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/hidro_em_operacao.png"> ' . t('In operation') . '</li> +                                      </ul> +                                    </span> + +                                <span id="lca" class="hide"> +                                <h2 class="legenda-cavernas"><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/caverna.png"> ' . t('Caves') . '</h2> +                                    </span> + +                                <span id="lmi"  class="hide"> +                                <h2">' . t('Mining') . '</h2> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/autorizacao-de-pesquisa.png"> ' . t('Autorização de pesquisa') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/concessao-de-lavra.png"> ' . t('Concessão de lavra') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/disponibilidade.png"> ' . t('Disponibilidade') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/lavra-garimpeira.png"> ' . t('Lavra garimpeira') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/licenciamento.png"> ' . t('Licenciamento') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/manifesto-de-mina.png"> ' . t('Manifesto de mina') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/registro-de-extracao.png"> ' . t('Registro de extração') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/requerimento-de-lavra.png"> ' . t('Requerimento de lavra garimpeira') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/requerimento-de-licenciamento.png"> ' . t('Requerimento de licenciamento') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/requerimentos-de-pesquisa.png"> ' . t('Requerimentos de pesquisa') . '</li> +<li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/requerimento-de-registro-de-extracao.png"> ' . t('Requerimento de registro de extração') . '</li> +                                    </span> + +                                <span id="lbi"  class="hide"> +                                <h2>' . t('Biomes') . '</h2> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/amazonia.png"> ' . t('Amazônia') . '</li> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/caatinga.png"> ' . t('Caatinga') . '</li> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/cerrado.png"> ' . t('Cerrado') . '</li> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/mata_atlantica.png"> ' . t('Mata Atlântica') . '</li> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/pampa.png"> ' . t('Pampa') . '</li> +                                   <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/pantanal.png"> ' . t('Pantanal') . '</li> +                                    </span> + +                                <span id="lfi" class="hide"> +                                <h2>' . t('Vegetation') . '</h2> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/campinarana.png"> ' . t('Campinarana') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/contato.png"> ' . t('Contato entre tipos vegetacionais') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/estepe.png"> ' . t('Estepe') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/floresta-estacional-decidual.png"> ' . t('Floresta estacional decidual') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/floresta-estacional-semidecidual.png"> ' . t('Floresta estacional semi-decidual') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/floresta-ombrofita-aberta.png"> ' . t('Floresta ombrófila aberta') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/floresta-ombrofita-densa.png"> ' . t('Floresta ombrófila densa') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/floresta-ombrofita-mista.png"> ' . t('Floresta ombrófila mista') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/formacoes-pioneiras.png"> ' . t('Formações pioneiras') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/refugio-ecologico.png"> ' . t('Refúgio ecológico') . '</li> +                     +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/savana.png"> ' . t('Savana') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/savana-estepica.png"> ' . t('Savana estépica') . '</li> +                                    </span> + + +                                <span id="lba"  class="hide"> +                                <h2>' . t('Bacias Hidrogáficas, Nível 1 e 2 (ANA)') . '</h2> +                                    <h5>' . t('Região Hidrográfica (Nível 1)') . '</h5> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-amazonica.png"> ' . t('Amazônica') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-araguaia-tocantins.png"> ' . t('Araguaia / Tocantins') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-atlantico-leste.png"> ' . t('Atlântico Leste') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-atlantico-nordeste-ocidental.png"> ' . t('Atlântico Nordeste Ocidental') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-atlantico-sudeste.png"> ' . t('Atlântico Sudeste') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-atlantico-sul.png"> ' . t('Atlântico Sul') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-paraguai.png"> ' . t('Paraguai') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-parana.png"> ' . t('Paraná') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-parnaiba"> ' . t('Parnaíba') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-sao-francisco.png"> ' . t('São Francisco') . '</li> +                                    <li><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/bacia-uruguai.png"> ' . t('Uruguai') . '</li> +                                    </span> +                           <span id="lamz"> +                                <h2><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/amz-legal.png" width="11" height="11"> '.t('Legal Amazon borders').'</h2> +                           </span> +                           </ul> +                           <span id="lbr" class="hide"> +                           <h2><img src="' . drupal_get_path('theme', 'ucstyle') . '/images/ramsar.png" width="20" height="20"> ' . t('Ramsar Sites') . '</h2> +                         </div>'.gmap_arcgis_link_nota_tecnica(), +        '#weight' => 8, +    ); + +    return $form; +} + +/** + * 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; + +        case 'view': + +                drupal_add_js('$(window).load(function() { +                    $("#slider").slider( +                        { +                          value:1, +                          min: -1, +                          max: 10, +                          step: 1, +                          start: function(event,ui) { +                           +                          //$.blockUI({ message: "<h1><img src=\"busy.gif\" /> Just a moment...</h1>" }); +                          }, +                          animate: true, +                          change: function(event, ui) { +                                     +                                    Desmatamento(ui.value) +                                  }, +                          slide: function(event,ui) { +                             +                            //$("#yy").html(ui.value); +                          } +                          }); +                      }); +                      ', +            'inline', 'header'); + +            drupal_add_js('$("#clickmapa").click(function() { +                        var options = {}; +			$("#uc-form").toggle("fold",options,500); +                        if($("#abrefecha").hasClass("close_gmap_arcgis")) { +                            $("#abrefecha").switchClass("open_gmap_arcgis","close_gmap_arcgis"); +			} else { +                            $("#abrefecha").switchClass("close_gmap_arcgis","open_gmap_arcgis"); +			 +                        } +                        return false; +		}); +', 'inline', 'footer'); +            $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>'; + +            return $blocks; + +        case 'configure': + +        case 'save': +    } +} + + +function gmap_arcgis_link_nota_tecnica() { +   // global $base_url; +    //$str = http://uc.socioambiental.org/quem-somos# + +    return l(t('More information about the map'),'quem-somos',array('fragment' => 'middle-tab-5', 'external' => TRUE)); + +} +  | 
