function add($x, $y, $width, $height, $noise) { $found = false; foreach ($this->arrayOfAreas as $area) { if ($area->x == $x && $area->y == $y) { $area->addMeasurement($noise); $found = true; } } if (!$found) { $ar = new Area(); array_push($this->arrayOfAreas, $ar->setData($x, $y, $width, $height)->addMeasurement($noise)); } return $this; } function addNotMeasuredAreas() { $lines = split("\n", file_get_contents('AreasOfInterest.csv')); foreach ($lines as $line) { list($areaid, $height, $width, $x, $y, $name) = split(";", $line); $found = false; foreach ($this->arrayOfAreas as $area) { if ($area->x == $x && $area->y == $y) { $found = true; break; } } if (!$found) { $ar = new Area(); array_push($this->arrayOfAreas, $ar->setData($x, $y, $width, $height)->addMeasurement(0)); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> --> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Silent places at the Rolex Learning Center</title> <!-- <link rel="stylesheet" type="text/css" href="http://www.000webhost.com/images/index/styles.css" /> --> </head> <body> <!-- PHP 5.2 --> <?php // to debug: http://hurl.it/ error_reporting(E_ALL); ini_set("display_errors", "1"); include "ffdb.inc.php"; // Flat File DataBase: .met file holds the schema and .dat file holds the data $db = new FFDB(); if (!$db->open("noisepoints")) { $schema = array(array("id", FFDB_INT_AUTOINC, "key"), array("bssid", FFDB_STRING), array("noise", FFDB_STRING), array("timestamp", FFDB_STRING)); if (!$db->create("noisepoints", $schema)) { user_error("Check if you have write permissions on this folder\n"); } } if (!empty($_POST)) { if (isset($_POST['db'])) { unlink('noisepoints.dat'); unlink('noisepoints.met'); echo "database emptied!\n"; } else { $record["bssid"] = $_POST['bssid']; $record["noise"] = $_POST['noise']; $record["timestamp"] = $_POST['timestamp'];
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Silent places at the Rolex Learning Center</title> </head> <body> <!-- PHP 5.2 --> <?php error_reporting(E_ALL); ini_set("display_errors", "1"); include "ffdb.inc.php"; // Flat File DataBase: .met file holds the schema and .dat file holds the data $db = new FFDB(); $aps = simplexml_load_file('aps.xml'); if (!empty($_POST) && $db->open("noisepoints")) { $min = $_POST['min']; // to debug: http://hurl.it/ $max = $_POST['max']; // if they are not null then append them in a file $bssid = "bssid"; $noise = "noise"; $timestamp = "timestamp"; // TODO: avg over the same area to reduce network IO foreach ($db->getall(NULL) as $item) { echo $item[$bssid] . $item[$timestamp] . $item[$noise]; if ($item[$timestamp] > $min && $item[$timestamp] < $max) { foreach ($aps->entry as $entry) { if ($entry->string == $item[$bssid]) { foreach ($entry->area as $area) { echo $area->heigth . " " . $area->width . " " . $area->x . " " . $area->y . " " . $item[$noise] . "\n";