From: Maxious Date: Fri, 21 Dec 2012 01:45:25 +0000 Subject: getfile and convo gen X-Git-Url: http://maxious.lambdacomplex.org/git/?p=scannr.git&a=commitdiff&h=12efdbf1954b5a0722cc7fa02879c007226404a8 --- getfile and convo gen --- --- 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/generateConvos.php +++ b/generateConvos.php @@ -8,18 +8,26 @@ $convo = Array(); foreach ($recordings as $i => $recording) { - if (count($convo) > 0 && strcasecmp($convo[count($convos)]['tgid'], $recording['tgid']) != 0) { + if (count($convo) > 0) { + echo "
".strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp']); + if (abs(strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp'])) > 2) { + echo " ".$convos[count($convos)-1][0]['call_timestamp']." ".$recording['call_timestamp']; + } + if (strcasecmp($convos[count($convos)-1][0]['tgid'], $recording['tgid']) != 0 ) { $convos[] = $convo; $convo = Array(); + } } ; //print_r($recording); $convo[] = $recording; //print_r($convo); - echo "
\n"; + //echo "
\n"; } foreach ($convos as $i => $convo) { - print_r($convo); - echo "
\n"; + foreach($convo as $recording) { + echo $recording['filename']." , "; + } + echo "

\n"; } ?> --- /dev/null +++ b/getfile.php @@ -1,1 +1,20 @@ + --- 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 @@ +