[7805] | 1 | <?php
|
---|
| 2 | require_once("../../config.php");
|
---|
| 3 | require_once($config['root']."/map/inc/kmlHandler.php");
|
---|
[7822] | 4 | /*
|
---|
| 5 | * Get the array containing all the nodes
|
---|
| 6 | */
|
---|
| 7 | $markers = get_node_array($config['kml_file']);
|
---|
[7805] | 8 |
|
---|
[7822] | 9 |
|
---|
[7805] | 10 | $suggested_markers = array();
|
---|
| 11 |
|
---|
[7822] | 12 | /*
|
---|
| 13 | * Get the value that has been sent in the url, if theres no value in the url, the value will be nothing.
|
---|
| 14 | */
|
---|
[7805] | 15 | if(isset($_GET['value']))
|
---|
| 16 | {
|
---|
| 17 | $typed_value = $_GET['value'];
|
---|
| 18 | }
|
---|
| 19 | else
|
---|
| 20 | {
|
---|
| 21 | $typed_value = "";
|
---|
| 22 | }
|
---|
| 23 |
|
---|
[7822] | 24 | /*
|
---|
| 25 | * Fill the markernames array with all the names from markers we have on the map.
|
---|
| 26 | */
|
---|
[7805] | 27 | foreach($markers as $marker)
|
---|
| 28 | {
|
---|
| 29 | $markernames[] = (string)$marker['name'];
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[7822] | 32 | /*
|
---|
| 33 | * If the typed value is equal to the first part of a node name, the nodename is inserted into the $suggested_markers array
|
---|
| 34 | */
|
---|
[7805] | 35 | if (strlen($typed_value) > 0)
|
---|
[7822] | 36 | {
|
---|
[7805] | 37 | for($i=0; $i<count($markernames); $i++)
|
---|
| 38 | {
|
---|
[7822] | 39 | $hint= "";
|
---|
| 40 | if (strtolower($typed_value)==strtolower(substr($markernames[$i],0,strlen($typed_value))))
|
---|
| 41 | {
|
---|
| 42 | $suggested_markers[]=$markernames[$i];
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
[7805] | 46 |
|
---|
[7822] | 47 | /*
|
---|
| 48 | * If there are no suggested markers, check if there is something that has been typed.
|
---|
| 49 | * If so there are no suggestions found.
|
---|
| 50 | * Else there has been nothing typed, so we show all the markers we have.
|
---|
| 51 | */
|
---|
[7805] | 52 | if ($suggested_markers == null)
|
---|
| 53 | {
|
---|
| 54 | if (strlen($typed_value) > 0)
|
---|
| 55 | {
|
---|
| 56 | $suggested_markers[] = "Geen suggesties";
|
---|
| 57 | }
|
---|
| 58 | else
|
---|
| 59 | {
|
---|
| 60 | $suggested_markers = $markernames;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[7822] | 64 | /*
|
---|
| 65 | * Make a list with all the suggested markers we have.
|
---|
| 66 | * onchange we call the goToMarker function in nodemapWL.js and set the constructor with the value of the selected option.
|
---|
| 67 | */
|
---|
[7820] | 68 | echo "<select multiple onchange='goToMarker(this.options[this.selectedIndex].text)'>";
|
---|
[7805] | 69 | foreach($suggested_markers as $name)
|
---|
| 70 | {
|
---|
| 71 | $name = (string)$name;
|
---|
[7820] | 72 | echo "<option value='{$name}' >{$name}</option>";
|
---|
[7805] | 73 | }
|
---|
| 74 | echo "</select>";
|
---|
| 75 |
|
---|
| 76 | ?>
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 |
|
---|