From: Maxious Date: Thu, 20 Dec 2012 23:40:41 +0000 Subject: graph date filter X-Git-Url: https://maxious.lambdacomplex.org/git/?p=scannr.git&a=commitdiff&h=32c426fb8b34c5d3c37af07f76b0b632997850d3 --- graph date filter --- --- a/calls.json.php +++ b/calls.json.php @@ -3,10 +3,10 @@ function getTGIDValuesByHour($TGID, $timeFrom, $timeTo) { global $conn; $sth = $conn->prepare( 'select tgid, min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings +where call_timestamp between to_timestamp(?) and to_timestamp(?) group by tgid, date_trunc(\'hour\', call_timestamp) order by time'); - $sth->execute( ); - //Array($TGID, $timeFrom, $timeTo) + $sth->execute(Array($timeFrom, $timeTo)); return $sth->fetchAll(); --- a/viewcalls.php +++ b/viewcalls.php @@ -1,7 +1,16 @@ prepare('select distinct date_trunc(\'day\', call_timestamp) as rdate from recordings order by rdate'); + + $sth->execute(); + foreach( $sth->fetchAll() as $row) { +echo ''.$row['rdate'].'
'; +} + ?>
@@ -48,7 +57,7 @@ Flotr.EventAdapter.observe(placeholder, 'flotr:click', function () { drawGraph(); }); - getData('','',''); + getData('','',''); }); @@ -91,3 +100,4 @@ +