169 lines
4.5 KiB
PHP
169 lines
4.5 KiB
PHP
<?require ("global.php");?>
|
|
<?
|
|
|
|
$userID = 0;
|
|
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
|
|
else { header("Location: /tick/login.html"); }
|
|
|
|
$stageID = 0;
|
|
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
|
|
else { header("Location: /tick/stages.php"); }
|
|
|
|
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
|
|
$result = mysql_query($query, $db);
|
|
|
|
if ($result)
|
|
{
|
|
while ($r = mysql_fetch_array($result))
|
|
{
|
|
$event_name = $r['event_name'];
|
|
$name = $r['name'];
|
|
}
|
|
mysql_free_result($result);
|
|
}
|
|
|
|
$query = "SELECT * FROM maps WHERE stageID = $stageID";
|
|
$result = mysql_query($query, $db);
|
|
if ($result)
|
|
{
|
|
while ($r = mysql_fetch_array($result))
|
|
{
|
|
$ID = $r['ID'];
|
|
$zoom = $r['zoom'];
|
|
$center_lat = $r['center_lat'];
|
|
$center_lon = $r['center_lon'];
|
|
$map_type = $r['map_type'];
|
|
}
|
|
mysql_free_result($result);
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
|
<title>OneTicker :: Maps :: Copy</title>
|
|
<link rel=stylesheet type="text/css" href="tick.css">
|
|
<style type="text/css">
|
|
v\:* {
|
|
behavior:url(#default#VML);
|
|
}
|
|
</style>
|
|
<script src="banner.js" type="text/javascript"></script>
|
|
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
|
|
var map;
|
|
var zoom = <? echo "$zoom"; ?>;
|
|
var center_lat = "<? echo "$center_lat"; ?>";
|
|
var center_lon = "<? echo "$center_lon"; ?>";
|
|
|
|
function onLoad()
|
|
{
|
|
var routes;
|
|
map = new GMap2(document.getElementById("map"));
|
|
map.addControl(new GLargeMapControl());
|
|
map.addControl(new GMapTypeControl());
|
|
map.setCenter(new GLatLng(<? echo "$center_lat"; ?>, <? echo "$center_lon"; ?>), <? echo "$zoom"; ?>, <? echo "$map_type"; ?>);
|
|
|
|
<?
|
|
|
|
$query = "SELECT * FROM segments WHERE stageID = $stageID";
|
|
$result = mysql_query($query, $db);
|
|
if ($result)
|
|
{
|
|
while ($r = mysql_fetch_array($result))
|
|
{
|
|
echo "routes = new Array();";
|
|
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $r['ID'] . " ORDER BY sequence";
|
|
$result2 = mysql_query($query2, $db);
|
|
if ($result2)
|
|
{
|
|
while ($r2 = mysql_fetch_array($result2))
|
|
{
|
|
$lat = $r2['latitude'];
|
|
$lon = $r2['longitude'];
|
|
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
|
|
echo "routes.push(point);";
|
|
}
|
|
mysql_free_result($result2);
|
|
}
|
|
echo "if (routes.length > 0) { map.addOverlay(new GPolyline(routes, '" . $r['color'] . "', 5)); }";
|
|
}
|
|
mysql_free_result($result);
|
|
}
|
|
|
|
?>
|
|
|
|
}
|
|
|
|
//]]>
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
|
|
|
|
<script type="text/javascript">banner(6);</script>
|
|
|
|
<form name="copy" action="courses_copy.php" method="post">
|
|
<input type="hidden" name="stageID" value="<? echo "$stageID"; ?>">
|
|
|
|
<table border=1 cellspacing=1 cellpadding=1 width="600">
|
|
<tr valign=top>
|
|
<td>
|
|
<div id="map" style="width: 330px; height: 467px; border: 2px solid #aaaaaa"></div>
|
|
</td>
|
|
<td><table cellpadding=2 cellspacing=2 border=0 width=270>
|
|
<tr>
|
|
<td colspan=2><div class=text>
|
|
Begin by selecting a course from the pulldown menu below.
|
|
|
|
<p>If you would like to copy this course map to this stage, click the button. <b>Make sure you want to do this, as it will erase any courses currently stored for this stage!</b>
|
|
</div></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align=center><div class=blacktext>
|
|
<select name=newStageID class=blacktext>
|
|
|
|
<?
|
|
|
|
$query = "SELECT events.name AS ename, stages.name AS sname, stages.ID FROM events, stages WHERE events.ID = stages.eventID and events.userID = $userID ORDER BY stages.date DESC";
|
|
$result = mysql_query($query, $db);
|
|
if ($result)
|
|
{
|
|
while ($r = mysql_fetch_array($result))
|
|
{
|
|
if ($r['ID'] != $stageID)
|
|
{
|
|
echo '<option value="' . $r['ID'] . '">' . $r['ename'] . ' :: ' . $r['sname'] . '</option>';
|
|
}
|
|
}
|
|
mysql_free_result($result);
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
</div></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align=center>
|
|
<p><input class=boldtext type="submit" name="submit" value="copy course">
|
|
</td>
|
|
</tr>
|
|
|
|
</table></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</form>
|
|
|
|
</body>
|
|
</html>
|