source: trunk/src/index.php@ 7720

Last change on this file since 7720 was 7720, checked in by Pieter Naber, 15 years ago

Adding a lot of checks for the variables in the status and the location file. Added even more comments everywhere

File size: 2.0 KB
Line 
1<?php
2/*
3 * Project: NodeMap2.0
4 * File: index.php
5 * Purpose: Main index file of application
6 */
7
8require_once('config.php');
9require_once($config['file_init']);
10
11// Creating a placemark using our class
12$kmlPlacemark1 = new KMLPlacemark();
13$kmlPlacemark1->setName('Test name');
14$kmlPlacemark1->setDescriptionLocation('Test location description');
15$kmlPlacemark1->setDescriptionStatus('Test status description');
16$kmlPlacemark1->setLatitude(52.138476);
17$kmlPlacemark1->setLongitude(4.463046);
18$kmlPlacemark1->setStyle(PLACEMARK_GREEN);
19
20// Creating a second placemark using our class
21$kmlPlacemark2 = new KMLPlacemark();
22$kmlPlacemark2->setName('Placemark 2 name');
23$kmlPlacemark2->setDescriptionLocation('This is the second placemark location description');
24$kmlPlacemark2->setDescriptionStatus('This is the second placemark status description');
25$kmlPlacemark2->setLatitude(52.638476);
26$kmlPlacemark2->setLongitude(4.063046);
27$kmlPlacemark2->setStyle(PLACEMARK_ORANGE);
28
29// Creating a KMLFile using our class, add our placemarks and echo
30$kml = new KMLFile();
31$kml->addPlacemark($kmlPlacemark1);
32$kml->addPlacemark($kmlPlacemark2);
33/*
34 * For testing, echo the example KML file
35 * echo $kml->toString();
36 * echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
37 */
38
39// Now let's try reading from files and parsing the data in the files.
40// First off, we create a new KMLFile object
41$kmlFile = new KMLFile();
42
43// Let's try to read the node location file
44$nodeLocation = new FileHandler($config['node_location_file'], 'r');
45$kmlFile->parseLocationFile($nodeLocation->read());
46/*
47 * For testing, echo the example KML file
48 * echo $kmlFile->toString();
49 * echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
50 */
51
52// Let's try to read the node status file
53$nodeStatus = new FileHandler($config['node_status_file'], 'r');
54$kmlFile->parseStatusFile($nodeStatus->read());
55
56// And echo the result to the screen
57echo $kmlFile->toString();
58?>
Note: See TracBrowser for help on using the repository browser.