Location: PHPKode > projects > KML share > kmlshare/index.php
<!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"/>
<?php
require("config.php");
include("layerdb.php");
$layerdb = new LayerDB();
echo "<title>". APP_TITLE . "</title>";
?>
  <?php
  $key = ($_SERVER['HTTP_HOST'] == "localhost") ?
  "ABQIAAAAmM566Q2eMlQeLkr82uhCdhRoy-kUQFeUVMMsHPPuFvXFywWpiRSN3GJvcBet-vqeHjad6VgOJp6SBQ" :
  "ABQIAAAAmM566Q2eMlQeLkr82uhCdhTZYkD1t1aDVKKnQ20LphXjVRZ14xRuSjDA2NOKSHi1Q142hMayNAe5Ig";
  print "<script " .
    "src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=".
    GMAP_API_KEY ."' type='text/javascript'></script>";
    ?>
  <script src="prototype.js"></script>
  <script src="autosuggest.js"></script>
  <script src="renderer.js"></script>
  <link rel="stylesheet" type="text/css" href="renderer.css" />
  <link rel="stylesheet" type="text/css" href="autosuggest.css" />
</head>
<body>
<table>
<col width='250,'>
<tr>
<td valign=top>
<br>
<?php echo APP_HEADING; ?>
  <div class=subtitle>
  <table><tr><td align=left>Search</td>
  <td align=right>
  <span class="help_link" topic="search">help</span>
  </td>
  </tr>
  </table>
  </div>
  <form id="searchform" onsubmit="javascript: return false;">
  <input type=text id=q name=q value='' autocomplete=off>
  <input type=submit value="Search" id='button_search'>
  <div id='autosuggest'></div>
  </form>
  <div class=subtitle>Browse</div>
  <p> Zoom/Pan the map to view region of Interest
  or <span class="pseudolink" id="button_poi">specify a point</span>
  <?php
  function layer_row($layer) {
    $str = "";
    $lid = $layer->id;
    $color = $layer->color;
    $name = $layer->name;
    $str .= "<tr>";
    $str .= "<td><img src='" . $layer->icon ."'></td>";
    $str .= "<td>$name</td>";
    $str .= "<td><input name=checkbox_region type=checkbox value='$lid' ".
      "id='checkbox_$lid'></td>";
    if ($layer->status != 'locked') {
      $str .= "<td><a
	href='editlayer.php?layerid=$lid&submit=edit'>edit</a></td>";
      $str .= "<td><a
	href='editlayer.php?layerid=$lid&submit=Download'>kml</a></td>";
    }
    $str .= "<td>";
    if ($layer->status != 'locked') {
      $str .= "<span class=add_point layerid=$lid>add</span>";
    }
    $str .= "</td>";
    $str .= "</tr>";
    return $str;
  }

  // Fetch all the rows
  $layers = $layerdb->getLayerArray();
  $num_layers = count($layers);
  if ($num_layers > 0) {
    print "<table border=0><col width='20,120,20,30,30'>";
    print "<tr><th colspan=6 align=left>Civic Agencies Layers</th></tr>";
    foreach ($layers as $layer) {
      if ($layer->status == "locked") {
	print layer_row($layer);
      }
    }
    print "<tr><th colspan=5 align=left>User Contributed Layers</th></tr>";
    foreach ($layers as $layer) {
      if ($layer->status == "live") {
	print layer_row($layer);
      }
    }
    print "</table>";
  }
  $layerdb->done();
?>
<p>
<input type=button value="Get Data" id='button_fetch'>
<!---
&nbsp;<input type=button value="Browse" id='button_browse'>
-->
&nbsp;<input type=button value='Clear Map' id='button_clear'>
<div class=subtitle>Contribute</div>
<p><a href='upload.php'>Upload KML file</a>
<br>
<div id="status" style="font-weight: bold; color: white; background-color: red;">Loading maps...</div>
<div id='results'>
</div>
<div id='add_point_div'>
</div>

</td>
<td valign=top>
  <div id="map" style="width: 600px; height: 500px"></div>
  </td>
  </tr>
<tr><td></td><td>
<?php echo APP_FOOTER; ?>
</td></tr>
  </table>

</body>
</html>
Return current item: KML share