From 5aa3817b3f48c5cc5ee0bbb569c60a6174fc241f Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <erasmussen2@unl.edu>
Date: Mon, 21 Sep 2009 15:44:28 +0000
Subject: [PATCH] convert decimal lat/lng to deg,min,sec

---
 plugins/globe/views/default/globe/content.php | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/plugins/globe/views/default/globe/content.php b/plugins/globe/views/default/globe/content.php
index a833999b..525ae319 100644
--- a/plugins/globe/views/default/globe/content.php
+++ b/plugins/globe/views/default/globe/content.php
@@ -37,6 +37,20 @@
 
 <div class="globeGroup" id="plotMe">
 	<?php
+	
+	function DECtoDMS($dec)
+	{
+	    $vars = explode(".",$dec);
+	    $deg = $vars[0];
+	    $tempma = "0.".$vars[1];
+	
+	    $tempma = $tempma * 3600;
+	    $min = floor($tempma / 60);
+	    $sec = $tempma - ($min*60);
+	
+	    return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
+	}  
+  
 	if (isloggedin()) {
 	$me = get_user($_SESSION['user']->guid);
 	
@@ -59,9 +73,9 @@
 		<img src="<?php echo $_SESSION['user']->getIcon('small'); ?>" alt="Your Profile Icon" id="YourselfOnTheMap" style="cursor:default !important" />
 		<?php }?>
 		
-			<?php if($me->latitude) { ?>
+			<?php if($me->latitude) { $DMS_lat = DECtoDMS($me->latitude);$DMS_lng = DECtoDMS($me->longitude); ?>		
 			<span class="locationMe">Location: <?php echo $me->profile_country . " - " . str_replace("'","\'",htmlentities(ucwords($me->profile_city))) . ", " . $me->profile_state ?></span>
-			<span class="latlngMe">Latitude: <?php echo $me->latitude ?> &nbsp;&nbsp;&nbsp; Longitude: <?php echo $me->longitude ?></span>
+			<span class="latlngMe">Latitude: <?php echo $DMS_lat['deg']."&deg; ".$DMS_lat['min']."' ".$DMS_lat['sec']."\"" ?> &nbsp;&nbsp;&nbsp; Longitude: <?php echo $DMS_lng['deg']."&deg; ".$DMS_lng['min']."' ".$DMS_lng['sec']."\"" ?></span>
 			<?php } else { ?>
 			<span class="locationMe">You haven't added your location yet,</span>
 			<span class="latlngMe"><a href="<?php echo $CONFIG->url ?>mod/profile/edit.php?username=<?php echo $me->username ?>">Edit your profile</a> and put yourself on the map!</span>		
@@ -326,4 +340,4 @@
 
 <div class="clear"></div>
 
-<p style="font-size:.8em;font-style:italic;margin-top:20px">Icons are only clickable if that user has edited their profile with their location.  Otherwise, we don't know where to put them!</p>
+<p style="font-size:.8em;font-style:italic;margin-top:70px">Icons are only clickable if that user has edited their profile with their location.  Otherwise, we don't know where to put them!</p>
-- 
GitLab