Skip to content
Snippets Groups Projects
Commit 5aa3817b authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

convert decimal lat/lng to deg,min,sec

parent 14674924
No related branches found
No related tags found
No related merge requests found
......@@ -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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment