コード例 #1
0
 public function itemGoogleMap($item = null, $width = '200px', $height = '200px', $hasBalloonForMarker = false, $markerHtmlClassName = 'geolocation_balloon')
 {
     $divId = "item-map-{$item->id}";
     $location = get_db()->getTable('Location')->findLocationByItem($item, true);
     // Only set the center of the map if this item actually has a location
     // associated with it
     if ($location) {
         $center['latitude'] = $location->latitude;
         $center['longitude'] = $location->longitude;
         $center['zoomLevel'] = $location->zoom_level;
         $center['show'] = true;
         if ($hasBalloonForMarker) {
             $titleLink = link_to_item(metadata($item, array('Dublin Core', 'Title'), array(), $item), array(), 'show', $item);
             $thumbnailLink = !item_image('thumbnail') ? '' : link_to_item(item_image('thumbnail', array(), 0, $item), array(), 'show', $item);
             $description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150), $item);
             $center['markerHtml'] = '<div class="' . $markerHtmlClassName . '">' . '<div class="geolocation_balloon_title">' . $titleLink . '</div>' . '<div class="geolocation_balloon_thumbnail">' . $thumbnailLink . '</div>' . '<p class="geolocation_balloon_description">' . $description . '</p></div>';
         }
         $overlays = GeolocationPlugin::GeolocationConvertOverlayJsonForUse();
         $options = array();
         $options['mapType'] = get_option('geolocation_map_type');
         if ($overlays) {
             $options['overlay'] = $location->overlay;
         }
         $center = js_escape($center);
         $options = js_escape($options);
         $style = "width: {$width}; height: {$height}";
         $html = '<div id="' . $divId . '" class="map geolocation-map" style="' . $style . '"></div>';
         $js = "var " . Inflector::variablize($divId) . ";";
         if ($overlays) {
             $js .= "var mapOverlays = " . $overlays["jsData"] . ";";
         }
         $js .= "OmekaMapSingle = new OmekaMapSingle(" . js_escape($divId) . ", {$center}, {$options}); ";
         $html .= "<script type='text/javascript'>{$js}</script>";
     } else {
         $html = '<p class="map-notification">' . __('This item has no location info associated with it.') . '</p>';
     }
     return $html;
 }
コード例 #2
0
 public function googleMap($divId = 'map', $options = array(), $attrs = array(), $center = array())
 {
     if (!$center) {
         $center = array('latitude' => (double) get_option('geolocation_default_latitude'), 'longitude' => (double) get_option('geolocation_default_longitude'), 'zoomLevel' => (double) get_option('geolocation_default_zoom_level'));
     }
     if (!array_key_exists('params', $options)) {
         $options['params'] = array();
     }
     if (!array_key_exists('uri', $options)) {
         // This should not be a link to the public side b/c then all the URLs that
         // are generated inside the KML will also link to the public side.
         $options['uri'] = url('geolocation/map.kml');
     }
     if (!array_key_exists('mapType', $options)) {
         $options['mapType'] = get_option('geolocation_map_type');
     }
     if (!array_key_exists('fitMarkers', $options)) {
         $options['fitMarkers'] = (bool) get_option('geolocation_auto_fit_browse');
     }
     $class = 'map geolocation-map';
     if (isset($attrs['class'])) {
         $class .= ' ' . $attrs['class'];
     }
     $options = js_escape($options);
     $center = js_escape($center);
     $varDivId = Inflector::variablize($divId);
     $divAttrs = array_merge($attrs, array('id' => $divId, 'class' => $class));
     $html = '<div ' . tag_attributes($divAttrs) . '></div>';
     $overlays = GeolocationPlugin::GeolocationConvertOverlayJsonForUse();
     $js = "var {$varDivId}" . "OmekaMapBrowse = new OmekaMapBrowse(" . js_escape($divId) . ", {$center}, {$options}); ";
     if ($overlays) {
         $js .= "var mapOverlays = " . $overlays["jsData"];
     }
     $html .= "<script type='text/javascript'>{$js}</script>";
     return $html;
 }
コード例 #3
0
ファイル: browse.php プロジェクト: GerZah/plugin-Geolocation
$title = __("Browse Items on the Map") . ' (' . html_escape($totalItems) . ' ' . __('total') . ')';
echo head(array('title' => $title));
echo item_search_filters();
echo pagination_links();
?>

<div id="geolocation-browse">
    <?php 
echo $this->googleMap('map_browse', array('list' => 'map-links', 'params' => $params));
?>
    <div id="map-links"><h2><?php 
echo __('Find An Item on the Map');
?>
</h2></div>
    <?php 
$overlays = GeolocationPlugin::GeolocationConvertOverlayJsonForUse();
if ($overlays) {
    $overlay = -1;
    echo '<div>' . '<span style="display:inline-block;"><h4>' . __("Select Map Overlay:") . ' </h4></span> ' . '<span style="display:inline-block;"><form>' . get_view()->formSelect('geolocation[overlay]', $overlay, null, $overlays["jsSelect"]) . '</form></span>' . '<span id="ovlOpacSlider" style="display:inline-block; width: 10em; margin-left:1em;"></span>' . '</div>';
}
?>
</div>

<div id="search_block">
    <?php 
echo items_search_form(array('id' => 'search'), $_SERVER['REQUEST_URI']);
?>
</div><!-- end search_block -->

<?php 
echo foot();
コード例 #4
0
 /**
  * Additional item display: display reverse references and reference maps / 2nd level reference maps
  */
 public function hookAdminItemsShow($args)
 {
     echo '<link href="' . css_src('item-references-maps') . '" rel="stylesheet">';
     if (SELF::$_enhancedGeoLog) {
         $overlays = GeolocationPlugin::GeolocationConvertOverlayJsonForUse();
     } else {
         $overlays = null;
     }
     SELF::_displaySelfReferences($args);
     $js = "";
     $js .= SELF::_displayReferenceMaps($args, $overlays);
     $js .= SELF::_displaySecondLevelReferenceMaps($args, $overlays);
     if ($js) {
         if ($overlays) {
             $js .= "var mapOverlays = " . $overlays["jsData"] . ";";
         }
         echo "<script type='text/javascript'>\n" . $js . "\n</script>";
     }
 }