select input
[scannr.git] / generateConvos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include('common.inc.php');
$sth = $conn->prepare('select * from recordings limit 100;');
 
$sth->execute();
$recordings = $sth->fetchAll();
$convos = Array();
$convo = Array();
foreach ($recordings as $i => $recording) {
 
    if (count($convo) > 0) {
        echo "<br> " . 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 "<br>\n";
}
foreach ($convos as $i => $convo) {
    foreach ($convo as $recording) {
        echo $recording['filename'] . " , ";
    }
    echo "<br><hr>\n";
}
?>