From: Maxious Date: Fri, 12 Oct 2012 10:53:01 +0000 Subject: move files to data folder X-Git-Url: http://maxious.lambdacomplex.org/git/?p=scannr.git&a=commitdiff&h=53e111b6c3c45b7d118a1c15b3d0583610dbdf7b --- move files to data folder --- --- /dev/null +++ b/.gitignore @@ -1,1 +1,3 @@ - +*.wav +*.pyc +/nbproject/private/ --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ [submodule "pynma"] path = pynma url = git://github.com/uskr/pynma.git +[submodule "js/flotr2"] + path = js/flotr2 + url = git://github.com/HumbleSoftware/Flotr2.git --- /dev/null +++ b/.idea/encodings.xml @@ -1,1 +1,6 @@ + + + + + --- /dev/null +++ b/.idea/misc.xml @@ -1,1 +1,9 @@ + + + + jar:file:\C:\Program Files (x86)\JetBrains\PhpStorm 5.0.2\lib\webide.jar!\resources\html5-schema\html5.rnc + + + + --- /dev/null +++ b/.idea/modules.xml @@ -1,1 +1,10 @@ + + + + + + + + + --- /dev/null +++ b/.idea/scannr.iml @@ -1,1 +1,10 @@ + + + + + + + + + --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -1,1 +1,5 @@ - + + + + --- /dev/null +++ b/.idea/vcs.xml @@ -1,1 +1,10 @@ + + + + + + + + + --- /dev/null +++ b/calls.json.php @@ -1,1 +1,39 @@ +get_timezone_offset("UTC"); + foreach ($values as $value) { + $data[] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['avg'])); + } + $this->output + ->set_content_type('application/json') + ->set_output(json_encode(Array("label" => $label, "data" => $data, + "previous" => Array( + "from" => $timefrom - (24 * 60 * 60), + "to" => $timefrom) + , + "next" => Array( + "to" => $timeto + (24 * 60 * 60), + "from" => $timeto) + ) + )); +} + +function json_data_description($sensorID, $timefrom, $timeto) { + $timefrom = strtotime($timefrom); + $timeto = strtotime($timeto); + $years = getSensorDataYears($sensorID, $timefrom, $timeto); + + $months = getSensorDataMonths($sensorID, $timefrom, $timeto); + $days = getSensorDataDays($sensorID, $timefrom, $timeto); + + return json_encode(Array("years" => $years, "months" => $months, "days" => $days + )); +} + +?> + --- /dev/null +++ b/common.inc.php @@ -1,1 +1,159 @@ +getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); + return $offset; +} + +function getSensorValuesByHour($sensorID, $timeFrom, $timeTo) { + $sql = 'select min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings + group by tgid, date_trunc(\'hour\', call_timestamp) order by time'; + + $query = $this->db->query($sql, Array($sensorID, $timeFrom, $timeTo)); + return $query->result_array(); +} + +function getSensorValuesByDay($sensorID, $dayFrom, $dayTo) { + $sql = 'select min(time) as time, min(value), max(value), avg(value), stddev(value) from sensor_values where sensor_id = ? + group by sensor_id, date_trunc(\'day\', time) order by time'; + + $query = $this->db->query($sql, Array($sensorID)); + return $query->result_array(); +} + +function getSensorDataYears($sensorID, $timeFrom, $timeTo) { + $sql = "select distinct extract('year' from call_timestamp) as year from recordings where tgid = ? order by year"; + + $query = $this->db->query($sql, Array($sensorID)); + return $query->result_array(); +} + +function getSensorDataMonths($sensorID, $timeFrom, $timeTo) { + $sql = "select distinct extract('month' from time) as month, extract('year' from time) as year from sensor_values where sensor_id = ? order by year, month"; + + $query = $this->db->query($sql, Array($sensorID)); + return $query->result_array(); +} + +function getSensorDataDays($sensorID, $timeFrom, $timeTo) { + $sql = "select distinct extract('day' from time) as day, extract('month' from time) as month, extract('year' from time) as year from sensor_values where sensor_id = ? order by year,month,day"; + + $query = $this->db->query($sql, Array($sensorID)); + return $query->result_array(); +} + +function include_header($title) { + global $basePath; + ?> + + + + + + + + + + + + + + <?php echo $title; ?> - Scannr + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +